Chris McGrath
Chris McGrath

Reputation: 1757

Umbraco Imagecropper returning blank urls on predefined crops

I currently have an image cropper set up as an added property to set thumbnail images on my Image media type

I am currently running into an issue where the Umbraco.Media(id).GetCropUrl() on the Media object is correctly returning the url for the original image but not returning any thing when I request the cropped image url by name my debug dump and current setup looks as follows

@foreach (var image in sliderData)
{
    <pre>
        @{ var m = Umbraco.Media(image.img.id); }
        Image.Id: @m.id      
        Original Crop Url: @m.GetCropUrl("gallerythumbnail")
        Wide Crop: @m.GetCropUrl("gallerythumbnail", "wide")
        Tall Crop: @m.GetCropUrl("gallerythumbnail", "tall")

    </pre>
}

Debug Code Debug Output Thumbnail Image Setup Datatype Setup

Upvotes: 0

Views: 1870

Answers (1)

denford mutseriwa
denford mutseriwa

Reputation: 538

Maybe try using a typed media instead of just media i.e. var m = Umbraco.TypedMedia(image.img.id); .

Personally i don't put the cropper in the content media but in the actual media area and just have a normal media picker in the content which give me the id of the media image. then i just get the cropper direct without having to reference the alias of the content picker so in your example above i would then be using:

@m.GetCropUrl("wide") instead of @m.GetCropUrl("gallerythumbnail", "wide") not sure how much of a difference that makes but u definitely used the typed media and that works fine.

Upvotes: 2

Related Questions