@{
var mediaId = 12312;
var mediaNode = Umbraco.TypedMedia(mediaId);
var url1 = mediaNode.Url; // url no cropping
var cropUrl = mediaNode.GetCropUrl("cropAlias"); // by alias, must define on DataType
var croUrl1 = mediaNode.GetCropUrl(width: 300, height: 300); // by size
}
However, using GetCropUrl("alias") gives me the following error:
'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'GetCropUrl' and no extension method 'GetCropUrl' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
I'm calling the media node using Umbraco.TypedMedia, the same way as in your code.
Get image crop url in Umbraco 6.1.6.
Hi,
Using Image Cropper, I've got cropping working and now I need to retrieve the crops of an image.
I can retrieve the crops using
@Umbraco.Media(imageRef).crops
however this is in DynamicXml format, which I can't seem to do much with.@Umbraco.Media(imageRef).crops.Find()
doesn't seem to work.Regards,
Miguel
This may help you.
Thank you for your response!
However, using
GetCropUrl("alias")
gives me the following error:I'm calling the media node using
Umbraco.TypedMedia
, the same way as in your code.Hi Miguel,
What ImageCropper are you using in v6.1.6? is it a custom package?
The native ImageCropper that utilizes
IPublishedContent.GetCropUrl(alias)
as suggested by Jivan was added in v7.1.4Cheers
James
is working on a reply...