Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a Image Cropper datatype setup with one Crop ("Promo"), in Umbraco 7.2.4. I can get the image with this code:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @foreach(var item in Umbraco.Content(1071).Children("Promo").Where("Visible"){ var image = item.promoBild; var cropUrl = image.GetCropUrl("promoBild", "Promo"); <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 sod-promo"> <img src="@cropUrl" /> <h2>item.promoRubrik</h2> <p>item.promoText</p> <p><a href="item.promoLank">Läs mer</a></p> </div> }
But I can´t get the image with the crop.
Observe that I have a doctype called Promo as well. Yes I know, sorry. promoBild is the name of the Image Cropper.
Hi Daniel,
This looks fine, have you checked the alias of the crop is "Promo"?
Jeavon
Yes, the crop alias is Promo.
Actually, I can get the image with this code:
var image = item.promoBild;<img src="@image.src" />
If I try to add the cropUrl, like this:
var image = item.promoBild;var cropUrl = image.GetCropUrl("promoBild","Promo");<img src="@cropUrl" />
I get an "Error loading Partial View script" error.
The Json code looks like this:
{ "focalPoint": { "left": 0.5025, "top": 0.66 }, "src": "/media/1003/fest.jpg", "crops": [ { "alias": "Promo", "width": 300, "height": 169 }]}
Ah, I think it should be item.GetCropUrl?
item.GetCropUrl
That works. Thanks a lot!
Great!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting the Src and Crop when using Image Cropper
I have a Image Cropper datatype setup with one Crop ("Promo"), in Umbraco 7.2.4. I can get the image with this code:
But I can´t get the image with the crop.
Observe that I have a doctype called Promo as well. Yes I know, sorry. promoBild is the name of the Image Cropper.
Hi Daniel,
This looks fine, have you checked the alias of the crop is "Promo"?
Jeavon
Yes, the crop alias is Promo.
Actually, I can get the image with this code:
If I try to add the cropUrl, like this:
I get an "Error loading Partial View script" error.
The Json code looks like this:
Ah, I think it should be
item.GetCropUrl
?That works. Thanks a lot!
Great!
is working on a reply...