I'm using Umbraco 7.14.0 and attempting to get a crop url. It's getting pretty frustrating because I can find many solutions online but none of them work for me.
On each category page I have a property entitled dropdownImage
I also have a crop alias of dropdown
So on each menuItem I would like to see IF there is a image and if so - display the cropped image. It might just be my lack of experience but I can't believe how challenging it is to display a cropped image.
(ignore this line, the editor goes crazy if I delete it)
@foreach (IPublishedContent menuItem in menuItems.Where(x => x.GetPropertyValue<bool>("umbracoNaviHide") == false))
{
var mediaItem = Umbraco.TypedContent(menuItem.Id).GetPropertyValue("dropdownImage");
if (mediaItem != null)
{
<img src="@menuItem.GetCropUrl("dropdownImage", "dropdown")" />
}
}
Something happened because the bool return true now so I can actually get inside the if-statement.
However the URL is still "unknown". I'm not sure if I'm running around in circles but the property alias "dropdownImage" is correct and the cropURL is correct "dropdown".
I also made sure that all media files is "included in project" in my visual studio.
Getting CropURL from specific node ID
Hi guys,
I'm using Umbraco 7.14.0 and attempting to get a crop url. It's getting pretty frustrating because I can find many solutions online but none of them work for me.
(ignore this line, the editor goes crazy if I delete it)
// Mike
Hi Mike
Try
Now if the MediaPicker allows you to pick multiple images then it will return an enumerable of multiple images so to use the first you would have:
regards
Marc
Hi Marc!
Something happened because the bool return true now so I can actually get inside the if-statement.
However the URL is still "unknown". I'm not sure if I'm running around in circles but the property alias "dropdownImage" is correct and the cropURL is correct "dropdown".
I also made sure that all media files is "included in project" in my visual studio.
You can see the backend values here: https://screenpresso.com/=KVGU
// Mike
Hi Mike nearly there...
Unfortunately typo in my reply - updated!
Should be
mediaItem.GetCropUrl("banner")
:-( #h5is
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.