I want to get a crop url in my UmbracoApiController-Class. I iterate over the nodes by ContentService-Class and access the image-Value with content.GetValue("image"), returning the json-string with all the crop infos.
But how do I get the crop-Url of a specific crop-alias?
Access crop URL from c#
Hi,
I want to get a crop url in my UmbracoApiController-Class. I iterate over the nodes by ContentService-Class and access the image-Value with content.GetValue("image"), returning the json-string with all the crop infos.
But how do I get the crop-Url of a specific crop-alias?
Best regards -
Tom
Hi Amalie,
thanks for the quick reply. But in Umbraco 7.1.4 there seems to be no Umbraco.Media anymore...
I have used it in umbraco 7.1.4
You can see the documentation for the image cropper here
http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Image-Cropper
Ok, there seems to be a bug in the 7.1.6 - I do not get the crop with GetCropUrl.
I get this URL and as you see, the picture is not 800x800:
http://secondhair.sitepoint.de/media/1013/bm_city_kiew-champagne-mix_5885.jpg?crop=0.0000000000000001263187085796,0.029629629629629631,0,0.3037037037037037&cropmode=percentage&width=800&height=800&rnd=130536255070000000
I will do a bug-report.
Did you create the crop after uploading the image? If you did, go to the media folder and re-save the picture.
Ok. My mistake, I had to add this to the web.config:
httpModule:
And in system.webServer/modules add:
Anyway, I created a cropper in the content-section, not in the media-section.
If I call the getCropUrl-Function within my template, all of these calls work:
But if I call it from my C# Code in my UmbracoApiController, it does not return the crop-Url, but the path to the node:
Umbraco.Content(3192).GetCropUrl("bild", "klein") returns:
/dening-hair-company/peruecken/bianca/?mode=pad&rnd=130536278570000000
instead of:
/media/1916/bianca_terracotta-mix-root_0042011_01_2400x3600fb94.jpg?crop=0,0.048888888888888891,0,0.28444444444444444&cropmode=percentage&width=300&height=300&rnd=130536278570000000
as it does in the template-code.
Ok, if I call it this way, it works (why ever):
Thanks for your support though!
is working on a reply...