Copied to clipboard

Flag this post as spam?

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


  • Heather Floyd 531 posts 787 karma points MVP 2x c-trib
    May 14, 2020 @ 17:54
    Heather Floyd
    0

    GetCropUrl() using cropAlias generates incorrectly sized image

    In the process of migrating a v7 website to v8 I came a cross a very strange issue - This code:

    <img src="@featuredPost.BlogPostThumbnail.GetCropUrl(cropAlias: "blogThumbnail", useCropDimensions: true)"/>
    

    in a View, renders the correct ImageProcessor URL:

    <img src="/media/4395/shutterstock_256320622_girl-with-tree.jpg?anchor=center&mode=crop&width=610&height=329&rnd=132276454024830000"/>
    

    But the image as displayed, is shown as being 335 pixels in height, instead of the specified 329:

    https://snipboard.io/IC3Jdm.jpg

    Has anyone seen this issue?

  • Heather Floyd 531 posts 787 karma points MVP 2x c-trib
    May 14, 2020 @ 20:56
    Heather Floyd
    0

    So, I've realized that ImageProcessor just isn't getting used at all - there is no "App_Data/cache" folder.

    I have compared all the configs to the 8.6.1 download, and nothing seems amiss.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 14, 2020 @ 21:07
    Alex Skrypnyk
    1

    Hi Heather

    Can you check files and folders permissions? Mayne Umbraco can't create a folder under /app_data?

    Thanks,

    Alex

  • Heather Floyd 531 posts 787 karma points MVP 2x c-trib
    May 14, 2020 @ 21:10
    Heather Floyd
    0

    Okay, so using this DOES work:

    featuredPost.BlogPostThumbnail.GetCropUrl(610,329)
    

    The generated img src is:

    /media/4395/shutterstock_256320622_girl-with-tree.jpg?center=0.46832782948063639,0.58439388147611493&mode=crop&width=610&height=329&rnd=132339387248830000
    

    but this doesn't:

    featuredPost.BlogPostThumbnail.GetCropUrl("blogThumbnail")
    

    The generated img src is:

    /media/4395/shutterstock_256320622_girl-with-tree.jpg?crop=0,0.093333333333333338,0,0.097650273224043641&cropmode=percentage&width=610&height=329&rnd=132339387248830000
    

    So perhaps those parameters aren't valid for ImageProcessor...

    If I edit the url in the HTML via Dev console in the browser, and remove "&width=610&height=329" - the image displays properly.

    So, perhaps this is a bug in the v8 implementation of .GetCropUrl(ALIAS)...?

  • Heather Floyd 531 posts 787 karma points MVP 2x c-trib
    May 14, 2020 @ 22:36
    Heather Floyd
    100

    I've added an Issue tot he tracker for this: https://github.com/umbraco/Umbraco-CMS/issues/8116

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies