Copied to clipboard

Flag this post as spam?

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


  • Roberto Bianchi 137 posts 446 karma points c-trib
    Jul 24, 2015 @ 10:28
    Roberto Bianchi
    0

    Umbraco Crop Image "on the fly" not work for child

    Hello :)

    I have this problem: if I would like to crop an image "on the fly" and I am in the CurrentPage I can do it without problem, using this code:

    <img src="@Model.Content.GetCropUrl(propertyAlias: "imageFieldName", height:71, width:485)" />
    

    If instead I want to do the same thing with a child page, I don't see nothing... This is the code:

    @{
        foreach(var childPage in CurrentPage.Children)
        {
            <img src='@childPage.GetCropUrl(propertyAlias: "imageFieldName", height:300, width:400)' />
        }
    }
    

    If instead I use this code (not crop "on the fly"), it works:

    <img src='@childPage.GetCropUrl("imageFieldName","small")' />
    

    Where am I wrong?

  • James Jackson-South 489 posts 1747 karma points c-trib
    Jul 24, 2015 @ 14:21
    James Jackson-South
    0

    Hi Bob,

    What do you mean by doesn't work. Is there an image rendered or is it just not cropped? Could you share a sample url that is generated?

    Cheers

    James

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Jul 24, 2015 @ 14:30
    Roberto Bianchi
    0

    Hi James, the problem is that the image is not rendered.

    The result of the code:

    <img src='@childPage.GetCropUrl(propertyAlias: "imageFieldName", height:300, width:400)' />
    

    is:

     <img src="" />
    
  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 24, 2015 @ 13:45
    Roberto Bianchi
    0

    Nobody can help me?

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 08:02
    Mads Krohn
    0

    Hi Bob

    Could you elaborate on the "I don't see nothing" part?
    Can you see the img-tag in the code, without any src-attribute, or is the img-tag simply not rendered at all ?

    Cheers Mads

    Edit: Ok, I did not read the answers careful enough, sorry :)
    The code, imo, looks fine though, not really sure whats going on, sorry.

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 08:13
    Mads Krohn
    0

    Quick question, what version of Umbraco 7 are you using ?

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 25, 2015 @ 08:15
    Roberto Bianchi
    0

    7.2.4

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 25, 2015 @ 08:16
    Roberto Bianchi
    0

    Can you try to use the same code I post before in a test website? So we can see if it's a server problem or a Umbraco's bug...

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 08:22
    Mads Krohn
    0

    I might, but firstly I would suggest that you start by ensuring that you are using the latest version of ImageProcessor in your project.

    Also, you could check the change logs for version 7.2.5-7.2.8 to see if anything related to GetCropUrl is mentioned and fixed.

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 25, 2015 @ 08:36
    Roberto Bianchi
    0

    How can I check if I use the latest version of ImageProcessor?

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 09:53
    Mads Krohn
    0

    I'm assuming that you are not using NuGet?
    Find the ImageProcessor dll's in the bin folder -> properties -> details -> product version
    Then match that to the newest versions -> http://imageprocessor.org/

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 25, 2015 @ 10:03
    Roberto Bianchi
    0

    Yes I don't use NuGet.

    My version is the 1.9.5.0

    The latest is 2.2.8

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 10:05
    Mads Krohn
    0

    I would suggest that you upgrade then. Both Core and Web. It might not help at all, but it will hopefully be easier to provide support.

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 25, 2015 @ 10:13
    Roberto Bianchi
    0

    How can I update? I only need to replace the ImageProcessor dlls?

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 25, 2015 @ 10:31
    Mads Krohn
    0

    If you are running the site as a Website (Visual Studio term), then yes, that is correct, replace the two dll's in the bin folder.

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Aug 24, 2016 @ 15:01
    Roberto Bianchi
    100

    I'd found a work-around... If I want to crop an image "on the fly", I add this string to the src tag of the image:

    ?mode=max&width=500
    
Please Sign in or register to post replies

Write your reply to:

Draft