Copied to clipboard

Flag this post as spam?

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


  • Ulrich Wagner Gade Ebsen 127 posts 277 karma points
    Jul 23, 2020 @ 17:34
    Ulrich Wagner Gade Ebsen
    0

    Mode always crop

    Hi,

    Just got the latest version and having some issues:

    src="@Url.GetCropUrl(Model.Image, 350, 320, quality:30, imageCropMode:ImageCropMode.BoxPad)"
    

    Mode is still rendered as mode=crop no matter what value i set ImageCropMode at...

    /ulrich

  • David Armitage 508 posts 2078 karma points
    Aug 01, 2020 @ 03:48
    David Armitage
    0

    Hi Ulrich,

    I had some similar problems in the past. Actually mainly when I was wanting to do some custom stuff to the cropped images such as render them as webP.

    I ended up creating a static image helper class to generate the correct crop url.

    I think you could get away with doing the same.

    1. Create a static method that will retunr the correct image url.

    2. Pass your umbraco image and crop name into the method.

    3. Get the prob url and examine it.

    4. If this is wrong you can so a replace to hack the correct data into the query string.

    5. Then return the fixd url.

      imageUrl = image.GetCropUrl(cropAlias: cropAlias); webpImageUrl = imageUrl + "&format=webp&quality=80";

    As you can see I did a very similar thing.

    Regards

    David

Please Sign in or register to post replies

Write your reply to:

Draft