Copied to clipboard

Flag this post as spam?

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


  • Gert 79 posts 285 karma points
    Sep 30, 2015 @ 11:22
    Gert
    0

    GetCropUrl in razor macro not working in production

    Hi,

    When using the GetCropUrl in my razor macro, the images are perfectly cropped on my development environment but ones I deploy my website to production, the images don't get cropped anymore. I'm using Umbraco 7.2.8.

    This is the code I'm using in my macro:

    <div class="products">
    @foreach ( var child in CurrentPage.Children )
    {
        var overviewImage = Umbraco.TypedMedia( ( int )child.ProjectOverviewImage.Id );
        string imgUrl = overviewImage.GetCropUrl( 118, 118 );
        string imageName = child.HasValue( PropertyAliasNames.MenuTitle ) ? child.MenuTitle : ( child.HasValue( PropertyAliasNames.PageTitle ) ? child.PageTitle : child.Name );
        <span class="albumCoverThumb">
        <a class="albumCoverThumbBorder" href="@child.Url"><img src="@imgUrl" alt="@imageName" /></a>
        ><br />
        @imageName
        <br /><br /><br /><br />
        </span>
    
    }
    

    And this is the result I'm getting on my machine in development:

    enter image description here

    But after publishing the website to production (shared hosting) I'm getting this as a result:

    enter image description here

    Does anybody has any clue what may cause this problem? Thanks!

    Kind Regards, Gert.

  • Wing 17 posts 39 karma points
    Sep 30, 2015 @ 11:52
    Wing
    0

    The cached images of the crops are saved in App_Data. Most likely you didn't deployed that, hence the crops won't be shown. Try to resave the media item, to resaved the cropped files and see if it works.

  • Gert 79 posts 285 karma points
    Sep 30, 2015 @ 12:02
    Gert
    0

    Hi Wing, thanks for you answer. It was a completely new deployment so everything was copied to the production website, the cached images included, so this could not be the problem. And the media item is cropped on the fly in razor and not in the content node.

    Any other ideas? Thanks!

    Kind Regards, Gert.

  • Gert 79 posts 285 karma points
    Oct 01, 2015 @ 10:03
    Gert
    100

    I found the solution, the ImageProcessor module wasn't served because the shared hosting environment was not running in Integrated Pipeline. After changing the cropping worked perfectly fine.

Please Sign in or register to post replies

Write your reply to:

Draft