Skip to content

Instantly share code, notes, and snippets.

@naepalm
Last active May 26, 2017 16:58
Show Gist options
  • Save naepalm/ef62771d72af15b9f337307eec01b4d1 to your computer and use it in GitHub Desktop.
Save naepalm/ef62771d72af15b9f337307eec01b4d1 to your computer and use it in GitHub Desktop.
A simple example of how to use the Zoom Area Cropper in a view.
@inherits UmbracoTemplatePage
@using ZoomAreaCropper.Models
@{
Layout = null;
}
@if (Model.Content.HasValue("photo"))
{
var photo = Model.Content.GetPropertyValue<ZoomAreaCropper>("photo");
if (photo.HasMedia)
{
@* Displays the original image as IPublished Content *@
<img src="@photo.Media.Url" />
}
if (photo.HasCrops)
{
foreach (var crop in photo.Crops)
{
if (crop.IsValid)
{
@* Displays pre-cropped images based on the original media items using ImageProcessor *@
<img src="@crop.Url" />
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment