Copied to clipboard

Flag this post as spam?

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


  • SC 12 posts 112 karma points
    Sep 09, 2019 @ 12:13
    SC
    0

    GetCropUrl

    When upgrading from 8.0.2 to 8.1.4, the IPublishedContent .GetCropUrl returns nothing. I can't seem to find a change regarding this, am I missing something?

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 09, 2019 @ 12:17
    Shaishav Karnani from digitallymedia.com
    0

    Hi,

    Does this work for you?

    IPublishedContent.Url.GetCropUrl

    Cheers,

    Shaishav

  • SC 12 posts 112 karma points
    Sep 09, 2019 @ 12:22
    SC
    0
    var test = expert.Url.GetCropUrl(); // returns URL of the IPublishedContent (this is the item which contains an image, so it's not correct
    
    var test2 = expert.Value<IPublishedContent>("expertPicture"); // returns null, while I can see the property in the Properties list
    
    var test3 = expert.GetCropUrl("expertPicture", "Expert Picture"); // returns an empty string
    

    I would expect test2 to work correctly, but it is not. Is it because the value is of a different type, something media related?

    Edit:

    var test = expert.Value<ImageCropperValue>("expertPicture");
    var test2 = test.GetCropUrl("Expert Picture");
    

    test is returning the correct value. test2 is returning a querystring (without url: "?anchor=center&mode=crop&width=500&height=500")

    Edit 2: current workaround solution (if this is not intended):

    var picture = expert.Value<ImageCropperValue>("expertPicture");
    var url = picture.Url;
    var cropUrl = url + picture.GetCropUrl("Expert Picture");
    
  • Florian Verdonck 2 posts 72 karma points
    Nov 24, 2019 @ 09:22
    Florian Verdonck
    0

    I'm using the same workaround as edit 2 but I find it strange that this is not default available.

  • guntur hakim 2 posts 72 karma points
    Feb 19, 2021 @ 07:23
    guntur hakim
    0

    Hi Shaishav, I'm facing kind of simmilar issuess, and way to fix you have been share is working well for me site best regards

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Aug 05, 2021 @ 22:21
    Heather Floyd
    0

    I wrote an extension method that helps with this issue in v8. See: https://our.umbraco.com/forum/umbraco-8/95932-getcropurl-returns-empty#comment-332558

Please Sign in or register to post replies

Write your reply to:

Draft