Determining if an Image Crop Exists within a Controller: 7.1
I'm using the new Image Cropper API inside a controller and was wondering what the best way is to determine if an image has a crop or not.
If you call the GetCropUrl method and an image doesn't have a crop it will return the image url and some padding details appended: /media/1006/picture008.jpg?mode=pad. As a side note, I'm not sure if it should be doing this.
To distinguish between an image that has the crop I want and one without any crop at all I'm using the following code:
c var images =
content.GetProperty("image")
.GetValue<string>()
.Split(',')
.Select(id => Umbraco.TypedMedia(id).GetCropUrl("thumbnail"))
.Where(image => image.Contains("=crop&"));
Note: I'm using the cropped images with a Multiple Media Picker.
Determining if an Image Crop Exists within a Controller: 7.1
I'm using the new Image Cropper API inside a controller and was wondering what the best way is to determine if an image has a crop or not.
If you call the
GetCropUrl
method and an image doesn't have a crop it will return the image url and some padding details appended:/media/1006/picture008.jpg?mode=pad
. As a side note, I'm not sure if it should be doing this.To distinguish between an image that has the crop I want and one without any crop at all I'm using the following code:
Note: I'm using the cropped images with a
Multiple Media Picker
.Is there a better way to do this?
is working on a reply...