Reputation: 63
I have uploaded an image to my Umbraco and I have not made crop images.
It is just a normal photo upload.
But is it possible that I can use GetCropUrl
with some parameters to retrieve this image ?.
Or do I have to do so
@if (Model.Content.HasValue("caseStudyImage"))
{
var caseStudyImage = Model.Content.GetPropertyValue<string>("caseStudyImages");
var caseStudyImage = Umbraco.TypedMedia(caseStudyImagesList);
<img src="@caseStudyImage.Url" style="width:300px;height:300px" />
}
Upvotes: 0
Views: 754
Reputation: 1285
Umbraco uses ImageProcessor so you can resize images by adding the appropriate query string parameters to the image URL. So in your case you could do the following:
<img src="@caseStudyImage.Url?width=300&height=300" />
You could also use the GetCropUrl
method by passing in the image dimensions:
<img src="@caseStudyImage.GetCropUrl(propertyAlias: "umbracoFile", height: 300, width: 300)" />
See the Umbraco docs for more information.
Upvotes: 4