Copied to clipboard

Flag this post as spam?

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


  • Jasmin 5 posts 85 karma points
    Apr 07, 2022 @ 08:45
    Jasmin
    0

    Image Cropper

    I have an image called "image" and the cropped version is called "SideImage". How can I use the cropped version of the image? The image is not saved in the media area.

    <img src="@Model.Value("bild")"/>
    

    I tried using .GetCropUrl() but it didn't work. Do I need to use a using or a package?

  • Marc Goodson 2157 posts 14435 karma points MVP 9x c-trib
    Apr 12, 2022 @ 06:27
    Marc Goodson
    0

    Hi Jasmin

    It's a while since I've used an ImageCropper as a property directly on a Document Type, I usually use a Media Picker (and MediaPicker3 allows you to access crop functionality) BUT

    I think you can use GetCropUrl(), there is a method here:

    https://github.com/umbraco/Umbraco-CMS/blob/5bfab13dc5a268714aad2426a2b68ab5561a6407/src/Umbraco.Web.Common/Extensions/UrlHelperExtensions.cs#L262

    that is a UrlHelper extensions, and seems to take the 'value' of the ImageCropper property, and then the name of the crop (and lots of other optional values)

    So hopefully something like this?

    <img src="@Url.GetCropUrl(Model.Value<ImageCropperValue>("bild"), "yourCropAlias")" />
    

    Namespace would be: Umbraco.Extensions

    regards

    Marc

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies