Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • [email protected] 30 posts 42 karma points
    May 27, 2009 @ 19:23
    r_lamb@hotmail.com
    0

    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!

  • [email protected] 30 posts 42 karma points
    May 27, 2009 @ 19:40
    r_lamb@hotmail.com
    0

    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!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 27, 2009 @ 21:18
    Dirk De Grave
    0

    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

  • [email protected] 30 posts 42 karma points
    Jun 04, 2009 @ 18:19
    r_lamb@hotmail.com
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft