Copied to clipboard

Flag this post as spam?

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


  • Osman Coskun 170 posts 404 karma points
    Mar 22, 2024 @ 19:34
    Osman Coskun
    0

    Setting imageCropMode site wide

    Hi, I see imageCropMode default is "Pad". I want to set imageCropMode: ImageCropMode.Crop as default mode for all GetCropUrl() calls. Is there a setting in appsettings or any other configuration available to set default cropmde? Version: Umbraco 13 TIA

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Mar 25, 2024 @ 22:40
    Marc Goodson
    1

    Hi Osman

    As you might have found, I think this is the line that defaults the crop mode to Pad for GetCropUrl...

    https://github.com/umbraco/Umbraco-CMS/blob/ce372abf8a87398e0a8d485f86caf00567e9ef73/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs#L484

    So you would probably need to create your own extension method GetOsmansCropUrl that would act as a wrapper around GetCropUrl, but always set the Crop Mode to your desired default type.

    There isn't a way to configure the default crop mode from appsettings etc

    Regards

    Marc

  • Osman Coskun 170 posts 404 karma points
    Mar 26, 2024 @ 06:42
    Osman Coskun
    101

    Hi Marc,

    I use custom code to generate image crop urls. It was working on 13.2.0. After upgrading to 13.2.1 GetCropUrl() started adding crop mode Pad. I updated my code and added mageCropMode: ImageCropMode.Crop. Now it works fine.

    Thanks & regards...

Please Sign in or register to post replies

Write your reply to:

Draft