Copied to clipboard

Flag this post as spam?

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


  • hakan 22 posts 116 karma points
    Aug 27, 2021 @ 15:46
    hakan
    0

    get cropped image fom multiple media picker

       foreach (var item in currentPage.Product.Images)
       {
            var imgSrc = item.GetCropUrl("x1");
            <img src="@imgSrc" alt="" />
       }
    

    currentPage.Product.Images is multiple media picker in umbraco panel I want to get cropped image with GetCropUrl func. but it is not working.

    I tried this as shown in the documentation but is not working

     foreach (var item in currentPage.Product.Images)
    {
        var imgSrc = item.GetLocalCropUrl("x1");
        <img src="@imgSrc" alt="" />
    }
    
  • Ilyas Balgabekov 21 posts 132 karma points
    Aug 28, 2021 @ 09:14
    Ilyas Balgabekov
    0

    Hello, hakan! Which version of Umbraco do you use?

  • hakan 22 posts 116 karma points
    Sep 01, 2021 @ 21:57
    hakan
    0

    I'm using v8. I solved problem like this

                     @{
                        var typedMultiMediaPicker = ((IEnumerable<MediaWithCrops>)item.Product.ListingImages);
    
                        foreach (var entry in typedMultiMediaPicker)
                        {
                            <img src="@entry.GetLocalCropUrl("x1")" class="c-item-A" />
                        }
                    }
    
Please Sign in or register to post replies

Write your reply to:

Draft