Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Dec 21, 2015 @ 13:45
    k
    0

    Image Cropper not working on umbraco 7.3

    Hello,

    image Cropper is not working on umbraco 7.3. I tried all possible codes but the src is empty.

    Did someone find a fix to the above problem or any solution.

    Thanks.

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Dec 23, 2015 @ 16:38
    Marc Goodson
    0

    Hi K

    What did you try ? if you can post some code we can try to fathom what might have gone wrong.

    Sometimes, if you have created the 'crop' after uploading the image; then opening up that image in the media section and saving it again can prompt the appearance of the cropurl!

    If not, then the way to troubleshoot this is to get the media item itself, using something like Umbraco.TypedMedia(mediaId) and verify that Umbraco is returning the Media item correctly; then use GetCropUrl on the media item itself...

    eg

    var relatedMedia = Umbraco.TypedMedia(content.GetPropertyValue("imagePropertyName"))
    
    var cropUrl = "";
    if (relatedMedia != null){
    cropUrl = relatedMedia.GetCropUrl("imagePropertyName");
    

    if that helps ?

  • Dan Roddis 57 posts 241 karma points
    Dec 23, 2015 @ 16:51
    Dan Roddis
    0

    Just an FYI we've used the ImageCropper on 7.3.0 and 7.3.4 without any problems so code would be useful

    I vaguely seem to remember we might have seen something similar in 7.3.0 but was related to us using something deprecated that was removed? I could be imagining that though.

  • k 256 posts 654 karma points
    Jan 08, 2016 @ 12:13
    k
    0

    Hello marc and Dan,

    Thank you both for your reply .

    I've used : img src='@Umbraco.Content(@CurrentPage.id).GetCropUrl("iamgename", "cropname")' "

    But the above is returning empty src.

  • Claushingebjerg 936 posts 2571 karma points
    Jan 08, 2016 @ 12:38
    Claushingebjerg
    0

    Have you tried the way described in the docs

    <img src='@CurrentPage.GetCropUrl("image", "banner")' />
    

    where "image" is the doctype property and "banner" is the crop alias.

    Reference: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/image-cropper

  • k 256 posts 654 karma points
    Jan 08, 2016 @ 12:41
    k
    0

    yes i tried but src is empty :(

  • Claushingebjerg 936 posts 2571 karma points
    Jan 08, 2016 @ 14:38
    Claushingebjerg
    0

    Try

        @{
    var featureImage = Umbraco.Media(CurrentPage.image);
    }
    
    <img src="@featureImage.GetCropUrl("banner")" />
    
  • k 256 posts 654 karma points
    Jan 11, 2016 @ 10:49
    k
    0

    Hello,

    Thnks for your reply I tried it but getting : Error loading Partial View script

  • Claushingebjerg 936 posts 2571 karma points
    Jan 11, 2016 @ 10:59
    Claushingebjerg
    0

    are you doing it in a partial view or directly in the template?

    I just tried both, and it works fine here.

  • k 256 posts 654 karma points
    Jan 11, 2016 @ 11:45
    k
    0

    when I am using it in partial view I am getting error .

    In template i am getting the below errors :

    The value of parameter 'id' must be either a string or an integer

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The value of parameter 'id' must be either a string or an integer

    Line 57: var featureImage = Umbraco.Content(CurrentPage.newsPic);

Please Sign in or register to post replies

Write your reply to:

Draft