@foreach (var child in subpage.Children.Where("Visible")) { if (child.HasValue("divisionSliderImage")) // check if there is an image for this page { <div style="height: 87px; width: 280px;"><img src="@Umbraco.TypedMedia(@child.GetPropertyValue("divisionSliderImage")).GetCropUrl(280, 87)"/></div> } }
but getting this error
Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'GetCropUrl'
Ok, so are you using a 3rd party package cropping images? The cropper was not built in untill the release of 7.1 if I remember correctly so the link I posted may not work as a reference then.
And is that other installation running the exact same version of Umbraco 7?
Ok - Does the @child.GetPropertyValue("divisionSliderImage") part of the code return an id if you just try to write out that part? And does the expression work if you just hardcode the image id just to see if it's something with the value fetched for the id that is wrong? I suspect it might be empty?
image getcropurl error
im adding a image reference in my partial view
but getting this error
Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'GetCropUrl'
Hi Mark
What version of Umbraco 7 are you using?
And have you consulted the documentation on how to fetch images using the cropper etc. here http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Image-Cropper ?
Hope this helps.
/Jan
thanks we upgraded to the latest version recently so yes its 7.0 something....
this code does work on another page which is odd....
Hi Mark
Ok, so are you using a 3rd party package cropping images? The cropper was not built in untill the release of 7.1 if I remember correctly so the link I posted may not work as a reference then.
And is that other installation running the exact same version of Umbraco 7?
/Jan
yes same site and yes its in in-built cropping package within umbraco
Hi Mark
Ok - Does the @child.GetPropertyValue("divisionSliderImage") part of the code return an id if you just try to write out that part? And does the expression work if you just hardcode the image id just to see if it's something with the value fetched for the id that is wrong? I suspect it might be empty?
/Jan
is working on a reply...