I'm hoping you can help me with some razor scripting. I have Umbraco 6.1.6 using the CWS Start" package that Warren Buckley created.
I am trying to retrieve an image crop using the default image cropper in Umbraco from a child node. The structure of the doc types being used are;
CWSUrlList = Parent Node CWSUrl = Child Node
Each CWSUrl node includes an image which is selected via DAMP and that I want to display on the parent node page (CWSUrlList).
Below is the code that is just about working. I say "just about" because since removing some of the @using / @inherits calls I initially was using, the image is no longer being pulled through.
The crop I am trying to establish is called "dampNewWide", and has been based on the DAMP sample pack. So the Doc Type CWSUrl includes a DAMP item called "dampNewWide".
I am trying to run the code below within an mvc template. The other properties such as date and price work correctly.
var urlDate =@Convert.ToDateTime(urlItem.GetProperty("itemDate").Value).Date.ToString("dd MMMM yyyy"); var price = urlItem.GetProperty("itemPrice").Value.ToString(); var image = urlItem.GetProperty("itemImage").Value; var mediaItem =Umbraco.TypedMedia(image); var mediaItemComplete = mediaItem.GetPropertyValue("umbracoFile"); <img src="@mediaItemComplete" alt="@mediaItem.GetPropertyValue("Name")"/>
Child Node & DAMP Media
Hello Umbraco Community.
I'm hoping you can help me with some razor scripting. I have Umbraco 6.1.6 using the CWS Start" package that Warren Buckley created.
I am trying to retrieve an image crop using the default image cropper in Umbraco from a child node. The structure of the doc types being used are;
CWSUrlList = Parent Node
CWSUrl = Child Node
Each CWSUrl node includes an image which is selected via DAMP and that I want to display on the parent node page (CWSUrlList).
Below is the code that is just about working. I say "just about" because since removing some of the @using / @inherits calls I initially was using, the image is no longer being pulled through.
The crop I am trying to establish is called "dampNewWide", and has been based on the DAMP sample pack. So the Doc Type CWSUrl includes a DAMP item called "dampNewWide".
I am trying to run the code below within an mvc template. The other properties such as date and price work correctly.
Any help would be greatly appreciated.
Dafydd
Hi Dafydd,
You should install the DAMP Property Editor Value Converter it makes this very easy.
There is also a samples package available http://our.umbraco.org/FileDownload?id=4718
Jeavon
Hello,
You could also have a look at the DAMP gallery or the Hybrid Framework for some examples.
The sample that Jeavon points to probably doesn't work on Umbraco v6, but only on v4.
Jeroen
Thanks for the response guys.
I have gone back to V4 for the time being but am determined to understand the new features of V6.
I will check out all of the suggestions once I reupload the V6 version of the site later today and report back.
Thanks again and have a great day.
Dafydd
is working on a reply...