Copied to clipboard

Flag this post as spam?

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


  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 20, 2017 @ 07:04
    ThomasBrunbjerg
    0

    Show specific crop of media item on template not using image cropper

    I am using a property editor which lets me edit my image crops for the media item in the content section, without needing to go to the media section. On my template I want to show a specific crop from my media picker (single image), which was edited in the content section.

    But so far I am only able to use the GetCropUrl method with the image cropper, which I don't have on my document type. I am using the included code in the documentation for showing a media item, but how do I use one of the predefined crops for my image to show in the template?

    The reason I am not just using the image cropper instead, is that the user should not need to upload an image first in the content section.

    @{
        var typedMediaPickerSingle = Model.Content.GetPropertyValue<IPublishedContent>("featuredBanner");
        if (typedMediaPickerSingle != null)
        {
            <p>@typedMediaPickerSingle.Url</p>
            <img src="@typedMediaPickerSingle.Url" alt="@typedMediaPickerSingle.GetPropertyValue("alt")" />
        }
    }   
    
  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 31, 2018 @ 23:24
    Alex Skrypnyk
    0

    Hi Thomas

    This is great idea - a property editor which lets me edit my image crops for the media item in the content section

    Can you share a source code?

    Alex

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Feb 13, 2018 @ 14:42
    Alex Skrypnyk
    0

    Hi Thomas,

    Did you find a solution? Share with our community, please

    /Alex

  • John Bergman 483 posts 1132 karma points
    Feb 14, 2018 @ 05:34
    John Bergman
    0

    Is the property editor you mentioned something you wrote, or is it a package already available somewhere?

Please Sign in or register to post replies

Write your reply to:

Draft