Copied to clipboard

Flag this post as spam?

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


  • k 255 posts 652 karma points
    Dec 11, 2015 @ 09:23
    k
    0

    cropping on umbraco 7.3.0

    Hello,

    I am using image cropper but I am unable to get the link of the cropped image using "GetCropUrl" .

    Can someone please help.

    Thanks in advance

  • Nathan Sleigh 109 posts 353 karma points
    Dec 11, 2015 @ 09:27
    Nathan Sleigh
    0

    Hi K,

    This is how I usually get the image crop Url.

      var backgroundImage = item.GetPropertyValue<string>("image");
      var cropName = "CropName";
      var imageUrl = "";
      var image = Umbraco.TypedMedia(int.Parse(backgroundImage));                
      var imageCropUrl = image.GetCropUrl(cropName);
      imageUrl = imageCropUrl;
    

    This works 100% of the time for me.

    Nathan

  • k 255 posts 652 karma points
    Dec 16, 2015 @ 13:22
    k
    0

    hello ,

    I am still having issue to get the cropped url.

    I am getting the url as empty xxx

    Can someone help.

    thanks

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Dec 16, 2015 @ 13:30
    Dennis Aaen
    0

    Hi k,

    Have your site been upgraded from a previous version of Umbraco, if so then I think that you should have a look at this package-

    https://our.umbraco.org/projects/collaboration/crop-healer-for-umbraco/

    Hope this helps,

    /Dennis

  • k 255 posts 652 karma points
    Dec 17, 2015 @ 07:16
    k
    0

    hello Denis ,

    I am working on umbraco 7.3 and it was not upgraded from a previous version.

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Dec 17, 2015 @ 07:47
    Dave Woestenborghs
    0

    Have you perhaps changed some dimension on the crop ? Than you need to run the package Dennis mentioned.

    Dave

  • k 255 posts 652 karma points
    Dec 17, 2015 @ 11:50
    k
    0

    I have created a new datatype named "newsimage" and choosed Image Cropper as Property editor .

    I have also install the package crop healer but cropping still not working.

    The image src is empty.

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Dec 17, 2015 @ 12:03
    Dennis Aaen
    0

    Hi k,

    Have you define any crops on the image cropper data type, try to see this documentation https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/image-cropper

    Or this uHangout episode. https://www.youtube.com/watch?v=bQsvGmnYaUU

    Hope this helps,

    /Dennis

  • k 255 posts 652 karma points
    Dec 18, 2015 @ 06:23
    k
    0

    Hello denis,

    Thank you for your link.

    I have followed the steps , but still getting empty src

    Please find my code below : foreach(var crop in news.imagenews.crops) { img src="@news.GetCropUrl("imagenews", crop.alias)"

    }

    Output :

    img src

  • Peter John 3 posts 73 karma points
    Dec 18, 2015 @ 09:30
    Peter John
    0

    This is not working for me after installation on my laptop.

  • k 255 posts 652 karma points
    Dec 21, 2015 @ 06:18
    k
    0

    Is there any fix for image cropper on umrbaco 7.3 ?

  • k 255 posts 652 karma points
    Jan 11, 2016 @ 18:22
    k
    0

    Hello nathan,

    I am trying your code again but I am stuck here : var image = Umbraco.TypedMedia(int.Parse(backgroundImage));

    I am getting rror loading Partial View script.

    Can you please help.

    Thanks,

  • Nathan Sleigh 109 posts 353 karma points
    Jan 12, 2016 @ 09:21
    Nathan Sleigh
    0

    Hi K,

    So what i usually do is set my Media Type of Image to use the image cropper. Once I have this done I attach the media picker to where ever I need an image and to render it out I use this code

    //Gets the Image ID
    var backgroundImage = item.GetPropertyValue<string>("image");
    //Get the Image Cropper Crop Alias
    var cropName = "CropName";
    //Set a variable to an empty string;
    var imageUrl = "";
    //Using the ID we got early turn it into a media item
    var image = Umbraco.TypedMedia(int.Parse(backgroundImage));
    //Once we have the media item we can get the crop url by getting the crop url name that we specified earlier      
    var imageCropUrl = image.GetCropUrl(cropName);
    //Setting the empty variable that we defined earlier to now contain the image Url
    imageUrl = imageCropUrl;
    

    I hope this makes sense?

    Nathan

  • k 255 posts 652 karma points
    Jan 12, 2016 @ 10:07
    k
    0

    I have created a new data type of type image cropper. I am not using media picker type.

    I have used the above code :

    var backgroundImage = news.GetPropertyValue

    var cropName = "newsimage";

    var imageUrl = "";

    var image = Umbraco.TypedMedia(int.Parse(backgroundImage));

    var imageCropUrl = image.GetCropUrl(cropName);

    imageUrl = imageCropUrl;

    img src='@imageUrl' />

    And i am getting the error : Exception: System.FormatException: Input string was not in a correct format.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies