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 107 posts 235 karma points
    22 days ago
    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 347 posts 1373 karma points
    1 week ago
    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