I'm trying to generate a photo album using the jQuery plug-in Galleriffic. I've got my images and thumbnails saved in their own directories in a distinct gallery folder.
--GalleryRoot
----slides
----thumbs
On the document type I have a Media Picker that points to the parent folder of the slides and thumbs folders, called GalleryRoot in the example above.
I'm very frustrated with getting the umbracoFile (image path) property for each image from both of the subfolders
The final HTML that I'm trying to generate should be a repeating series of <li> elements like this:
I've been trying to get to the umbracoFile property like this since I don't know how to debug live:
var children = uQuery.GetMedia(Model.imageLibrary).Children; var galleryName = uQuery.GetMedia(Model.imageLibrary).Text; var slides = children[0].Children; var thumbs = children[1].Children;
for(int x=0;x<slides.Length;x++) { <p>@slides[x].Id</p> Media media = @uQuery.GetMedia(@slides[x].Id); <p>@media.umbracoFile</p> }
The problem is that I get an error:
error CS1061: 'umbraco.cms.businesslogic.media.Media' does not contain a definition for 'umbracoFile'
I'm very new to this Razor syntax and my understanding of the Umbraco object model is limited so I'm probably missing something easy here. I would appreciate some help or direction in how to get to the umbracoFile property and the image URL. Thanks in advance for the help!
Get items in two different media folders
I'm trying to generate a photo album using the jQuery plug-in Galleriffic. I've got my images and thumbnails saved in their own directories in a distinct gallery folder.
--GalleryRoot
----slides
----thumbs
On the document type I have a Media Picker that points to the parent folder of the slides and thumbs folders, called GalleryRoot in the example above.
I'm very frustrated with getting the umbracoFile (image path) property for each image from both of the subfolders
The final HTML that I'm trying to generate should be a repeating series of <li> elements like this:
I've been trying to get to the umbracoFile property like this since I don't know how to debug live:
The problem is that I get an error:
error CS1061: 'umbraco.cms.businesslogic.media.Media' does not contain a definition for 'umbracoFile'
I'm very new to this Razor syntax and my understanding of the Umbraco object model is limited so I'm probably missing something easy here. I would appreciate some help or direction in how to get to the umbracoFile property and the image URL. Thanks in advance for the help!
Jeremy,
Media media = @uQuery.GetMedia(@slides[x].Id);
returns a Media object and the umbracoFile property can be retrieved using media.GetProperty("umbracoFile").Value.ToString()
If you want to use the Razor syntax, you'd need
which will return a DynamicMedia object, allowing to use the .umbracoFile notation to retrieve the property.
Hope this helps.
Regards,
/Dirk
Thanks so much, Dirk. Your suggestions were just what I was looking for. I would vote your answer as helpful, but I don't have enough karma yet.
is working on a reply...