Copied to clipboard

Flag this post as spam?

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

  • Robert J. Bullock 386 posts 405 karma points
    Dec 14, 2012 @ 21:06
    Robert J. Bullock

    How the heck do you get the URL from an ImageCropper datatype?!

    Driving me nutso! Have a property on my document type called "homeThumb", datatype of "homeThumb"... thumbnail is likewise called "homeThumb". This doesn't work:

    @foreach(var item in galleryFolder.Children){
           var thumbUrl = item.GetImageCropperUrl("homeThumb", "homeThumb");
    <img src="@thumbUrl"/>

    What am I doing wrong? "homeThumb" is the name of the docType property for the crop... Also tried supplying the property alias of the item being cropped ("photo")... Nothing. The loop works, just outputs nothing for @thumbUrl

  • Dmitriy Skudnov 39 posts 64 karma points
    Dec 16, 2012 @ 10:17
    Dmitriy Skudnov

     Here is code how i am doing that.

    var mediaFile = Model.MediaById(mediaId);
    var imageThumbnailUrl = mediaFile.umbracoFile;
    var crops = mediaFile.imageCropper;
    if (crops.Find("@name", "Front_Page_Slider").BaseElement != null)
    { imageThumbnailUrl = crops.Find("@name", "Front_Page_Slider").url; }

     Here is "Front_Page_Slider" - the name of the cropper in the docType.

Please Sign in or register to post replies

Write your reply to: