I've been reading about the getmedia method to retrieve images that have been uploaded to the current page using a media picker or upload, but I'm trying to just access files that have been uploaded to the media section of the admin. Can someone point me in the right direction to do this? Thanks!
I'm thinking you need some extra code to be able to get a media item based on a given name...
You'd still be using the same GetMedia(int) call, but before that, you'd need to get the id of a media item...
Query the database for an 'umbracoNode' for which text = 'givenName' and nodeObjectType = 'b796f64c-1f99-4ffb-b886-4bf4bc011a9c'
(Found guid of media item type in code...)
Query might return multiple records as well!!
If you need this functionality in xslt, than either use some inline c# code (Have a look at xslt search on how to write) or an xslt extension (search nibble.be for a example)
Thanks for the reply. I found a away around having to do this. Basically i was just approaching this the wrong way without really understanding it (happens to me alot as I'm so new to Umbraco). Thanks for the information though, i'm sure it will be useful for future challenges.
Accessing images loaded into Media
I've been reading about the getmedia method to retrieve images that have been uploaded to the current page using a media picker or upload, but I'm trying to just access files that have been uploaded to the media section of the admin. Can someone point me in the right direction to do this? Thanks!
I found that this works:
Anybody know how to do this without needing to know the ID? I'd rather be able to use the name given when the media item is created. Thanks!
Hi,
I'm thinking you need some extra code to be able to get a media item based on a given name...
You'd still be using the same GetMedia(int) call, but before that, you'd need to get the id of a media item...
Query the database for an 'umbracoNode' for which text = 'givenName' and nodeObjectType = 'b796f64c-1f99-4ffb-b886-4bf4bc011a9c'
(Found guid of media item type in code...)
Query might return multiple records as well!!
If you need this functionality in xslt, than either use some inline c# code (Have a look at xslt search on how to write) or an xslt extension (search nibble.be for a example)
Let us know what option you're going for.
Cheers,
/Dirk
Thanks for the reply. I found a away around having to do this. Basically i was just approaching this the wrong way without really understanding it (happens to me alot as I'm so new to Umbraco). Thanks for the information though, i'm sure it will be useful for future challenges.
is working on a reply...