Copied to clipboard

Flag this post as spam?

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


  • Luqman 6 posts 86 karma points
    Aug 31, 2020 @ 18:22
    Luqman
    0

    Image Cropper value cant capture.

    I cant capture the Image Cropper value. Since its actually appearing as there is a value for the property alias. Please help me how to get value of a image cropper and how to get cropped url.

    Attaching the screenshots below.

    1. Declared Featured Product Image as Image Cropper

    2. Value is captured while debugging, We can see this

    3. Finally if i try to get value as Value

    Declared Featured Product Image as Image Cropper.

    enter image description here

    enter image description here

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Sep 01, 2020 @ 10:12
    Steve Morgan
    100

    Hi,

    This stuff is confusing. What's stored in the featuredProductImage is not an IPublishedContent but the json for the image cropper.

    You need to give the URL helper an IpublishedContent (which in this case will be "item", the doc type property alias "featuredProductImage" and the crop alias "1920x1080" by the looks of it.

    So try:

        <h2>imageURl: @Url.GetCropUrl(item, "featuredProductImage", "1920x1080")</h2>
    

    if that works you probably want something like:

    var productImageUrl = item.HasValue("featuredProductImage") ? Url.GetCropUrl(item, "featuredProductImage", "1920x1080") : "#";
    
  • Steve Morgan 1346 posts 4453 karma points c-trib
    Sep 01, 2020 @ 10:13
    Steve Morgan
    0

    It's much easier if you use strongly typed models - look into the models builder ;)

  • Luqman 6 posts 86 karma points
    Sep 01, 2020 @ 10:29
    Luqman
    0

    Thanks @Steve Morgan.. Its now working fine with your solution

Please Sign in or register to post replies

Write your reply to:

Draft