Copied to clipboard

Flag this post as spam?

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


  • WURMi 4 posts 74 karma points
    Mar 25, 2017 @ 22:48
    WURMi
    0

    GetCropUrl with imageCropMode

    Hello,

    I'm using Umbraco version 7.5.9 and I have some difficulties using predefined crops with crop mode other than "Crop". I'd like to use predefined crop size with crop mode "Max".

    Let me write some samples:

    @mediaItem.GetCropUrl(cropAlias: "thumb_landscape", useCropDimensions: true)
    

    this work and return string is:

    /media/1115/u300981_medium.jpg?anchor=center&mode=crop&width=160&height=90&rnd=131349260720000000

    @mediaItem.GetCropUrl(cropAlias: "thumb_landscape", useCropDimensions: true, quality: 50)
    

    if I add some custom attributes like 'quality', it work as well:

    /media/1115/u300981_medium.jpg?anchor=center&mode=crop&quality=50&width=160&height=90&rnd=131349260720000000

    @mediaItem.GetCropUrl(cropAlias: "thumb_landscape", useCropDimensions: true, quality: 50, imageCropMode: ImageCropMode.Max)
    

    but why if I add imageCropMode with something other than 'Crop' width and height attributes disappears???

    /media/1115/u300981_medium.jpg?mode=max&quality=50&rnd=131349260720000000

    I spend couple of hours trying to understand if this is a some special feature or bug, but more and more I think it's a bug ;-/

    Thanks,

    Marek

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 27, 2017 @ 18:53
    Dan Diplo
    0

    The Umbraco image cropper actually utilises Image Processor in the background - the docs for resize modes are here - http://imageprocessor.org/imageprocessor-web/imageprocessingmodule/resize/

    Many of the crop modes keep the image's aspect ratio and only change the dimension of either height OR width, so it doesn't make sense to specify the exact size for both - they are dynamically calculated at runtime.

  • Josef Henryson 24 posts 98 karma points
    Oct 18, 2023 @ 08:43
    Josef Henryson
    0

    That link goes to a russian site. Feels unsafe.

  • Andrew Watt 21 posts 123 karma points
    Aug 22, 2024 @ 16:11
    Andrew Watt
    1

    The author let it expire some time in 2023. It's been obsolete for a long time. I used the Wayback Machine to pull some information recently: https://web.archive.org/web/20230324134858/https://imageprocessor.org/

  • Sven Geusens 169 posts 881 karma points c-trib
    Mar 28, 2017 @ 08:05
    Sven Geusens
    0

    But if you look at the max documentation, you will see you can specify both, so WURMi seems to be right to assume that there is a bug using the cropalias together with something else than crop

    Resize Max

    Resizes the image to the given dimensions. If the set dimensions do not match the aspect ratio of the original image then the output is resized to the maximum possible value in each direction while aintaining the original aspect ratio.

    http://your-image?width=500&height=500&mode=max

  • WURMi 4 posts 74 karma points
    Mar 28, 2017 @ 08:27
    WURMi
    0

    You're right Sven. This is exactly what I need to achieve. Using both dimensions (defined in crop alias) together with crop mode Resize Max

  • Sven Geusens 169 posts 881 karma points c-trib
    Mar 28, 2017 @ 11:57
    Sven Geusens
    0

    What happens if you put the height and width parameters in the generated url? Do you get the image in the correct format then? If so, maybe make a bug/feature report on the issue tracker

  • WURMi 4 posts 74 karma points
    Mar 28, 2017 @ 12:36
    WURMi
    0

    Yes, it work like described in documentation => the image is resized to the maximum possible dimensions in consideration of aspect ratio. So I will create a bug report on the issue tracker. Thanks for confirmation of my assumption ;)

  • Perry Cope 31 posts 195 karma points
    Jul 11, 2018 @ 15:03
    Perry Cope
    1

    I know this is old but was this ever fixed Im still seeing the same issue and googling only ever brings up this question.

  • Christian Reinholdt 2 posts 73 karma points
    Mar 11, 2021 @ 13:44
    Christian Reinholdt
    0

    I'm still seeing this issue 4 years later in 2021.

    Bug reported: https://github.com/umbraco/Umbraco-CMS/issues/9971

  • Hallie 1 post 71 karma points
    Mar 17, 2021 @ 04:06
    Hallie
    0

    One of the greatest challenges that come with creating a responsive, mobile-friendly site is to adapt your images for various smaller resolutions so that they're not the bandwidth-eating monsters you normally get on a desktop resolution.

Please Sign in or register to post replies

Write your reply to:

Draft