Copied to clipboard

Flag this post as spam?

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


  • Erik 7 posts 37 karma points
    May 17, 2014 @ 20:54
    Erik
    0

    How to get the url of cropped image

    Hi,

    I know this question has been asked before but I can't seem to get it to work properly. I've tried several examples but I can't seem to get past the { focalpoint ... output.

    I'm using Umbraco 7.1, rendering engine WebForms.

    I've tried 2 approaches both with the same result.

    First approach:

    I've created a new Image Cropper datatype called "Picture Cropper" with a crop called "cropPicture". Next I've created a property on a DocumentType called "picture" of type "Picture Cropper".

    Using razor I retrieve the image data as a string: @node.picture. I've also tried several options like @node.GetCropUrl("picture", "cropPicture"); I've also tried it without the first parameter and I've tried it with propertyAlias: picture, cropAlias: cropPicture.

    Second approach using MediaPicker:

    I've added a crop called "cropPicture" to the default Image Cropper. Next I've created a new Media Type called "Media Image Cropper" with a property called "picture" of type "Image Cropper". Next I add a MediaPicker property called "picture" on a DocumentType. In Razor I type: dynamic media = Media.MediaById(node.picture) which gives me a long string with focalpoint and crops. I've also tried @media.crops.Find("picture", "cropPicture") but this does not work either.

    What are the steps one should take when one has the image data as a string?

    Any help appreciated.

    Regards,

    Erik.

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 17, 2014 @ 22:57
    Jeavon Leopold
    101

    Hi Erik,

    It sounds like you have it setup correctly, however I think your issue is that you are using a Razor Macro with DynamicNode which are now legacy, instead you should be using Partial View Macros, then the GetCropUrl method would be working.

    Let me know if this makes sense?

    Jeavon

  • Erik 7 posts 37 karma points
    May 18, 2014 @ 23:15
    Erik
    0

    Tnx,

    This solved my problem!

    Regards,

    Erik.

Please Sign in or register to post replies

Write your reply to:

Draft