Copied to clipboard

Flag this post as spam?

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


  • lucuma 261 posts 563 karma points
    Feb 27, 2011 @ 20:49
    lucuma
    0

    Image Cropper as Upload Field on Document

    I think maybe i'm a little dense today, but I just can't seem to get the url of the cropped thumbnails.  The actual XML looks like this, however is there some easy way to get them using razor?  @Model.photo.crop[0] is accessible but it seems I have to do some string manipulations to generate the url from the umbracoFile?

        <umbracoFile>/media/624/img25large.jpg</umbracoFile>

            <photo>

                <crops date="27/02/2011 11:18:09">

                    <crop name="Thumbnail" x="51" y="180" x2="274" y2="353" />

                    <crop name="Large" x="420" y="23" x2="805" y2="431" />

                </crops>

            </photo>

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 28, 2011 @ 11:32
    Sebastiaan Janssen
    0

    How about @Model.photo.crop[0].url ?

    If the crop is empty, like in your example, you have to test first if the property "url" exists, which is something that's going to be included in the RC version that is going to be released today or tomorrow.

    Have a look at this topic as well.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Feb 28, 2011 @ 11:47
    Hendy Racher
    0

    Hi Lucuma,

    If you're using uComponents, there's a helper method in uQuery to return the url of a specified crop.

    string cropUrl = uQuery.GetCurrentNode().GetImageCropperUrl("cropperAlias", "cropName");

    HTH,

    Hendy

  • lucuma 261 posts 563 karma points
    Feb 28, 2011 @ 16:45
    lucuma
    0

    I'm not entirely sure why the URL isn't there considering I've uploaded, cropped, saved and published and confirmed the files exist on the server. Is there some reason why the URL property would be left off the crop node? I will test the jquery (thanks for the suggestion) but I assume it will return empty string.

Please Sign in or register to post replies

Write your reply to:

Draft