Created
June 6, 2014 08:10
-
-
Save Jeavon/0bfa4c82a0dd43ff2c52 to your computer and use it in GitHub Desktop.
GetCropUrl - check for predefined and fall back if not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
if (feature.HasValue("Image")) | |
{ | |
var featureImage = Umbraco.TypedMedia((int)feature.Image); | |
var myCropUrl = featureImage.GetCropUrl("PageBannerCrop") ?? featureImage.GetCropUrl(200, 100); | |
<a href="@feature.Url" class="image image-full"><img src="@myCropUrl" alt="" /></a> | |
} | |
} |
Hi Jeavon
Is there a way to change the black background added on non-aspect ratio resize of the image, assuming some sort of settings with image resizing but cant locate it. i would like to change that black default to white. any ideas?
@akeilox yes there is, hope you found the answer elsewhere already?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks - completely useful. And I've wrapped it in: EnsureCrop() which takes a defaultImgPath too. Thanks again!