Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 08, 2012 @ 13:51
    Fuji Kusaka
    0

    Replace image extension with cropper

    This code somehow just stopped working and displaying an error message when using Replace to display a cropped image.

    Any suggestion ?

    @{
      var newsItems = Model.NodeById(2148);
      var sortedItems = newsItems.Children.OrderBy("createDate descending");
      var itemsPerPage = 5;
      foreach(var page in sortedItems.Where("visible").Take(itemsPerPage))
      {   
         <li><a href="@page.Url">@page.Name </a>&nbsp;</li>
        <li><a href="@page.Url">@Library.Truncate(@Library.StripHtml(page.newsDesc), 50)</a></li>
        <li> <img src="@page.Media("newThumb","umbracoFile").Replace(".jpg","_thumb.jpg")" height="150" width="224"/></li>
          }
      }

  • Grant Thomas 291 posts 324 karma points
    Aug 08, 2012 @ 15:31
    Grant Thomas
    0

    Could it be that nothing has been specified for that property for that page, meaning 'umbracoFile' could be null? Just a thought.

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 08, 2012 @ 19:02
    Fuji Kusaka
    0

    Hi Grant,

    Thanks for the response. As i mentionedin my previous threat its really weird cos  it suddenly stopped working and now working again. Did change anything though.

    I have no idea what might be causing this to be honest.

    //fuji

Please Sign in or register to post replies

Write your reply to:

Draft