Copied to clipboard

Flag this post as spam?

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


  • darren wainwright 5 posts 25 karma points
    Jan 15, 2010 @ 10:34
    darren wainwright
    0

    How do i get an image path in asp.net?

    Hi all,

    I am in the middle of creating an asp.net (c#) user control (an image gallery). I am struggling to get the path of an image though...

    What the control will do:
    The user will add the macro to their site and set a parameter of 'folderName' - the foldername corresponds to the name of the folder within media; images for the gallery will be added to the media section.

    The control then recursively hunts through the 'GetRootMedias' nodes and looks for a type of folder with the given folder name - this then gives me .Children of Media

    I have the ID of these images and have tried NiceUrl, NiceUrlFullPath but am getting nothing returning.

    Is there a property/method that will return an image path?

     

    Cheers in advance

    Darren

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 15, 2010 @ 10:44
    Dirk De Grave
    1

    Hi Darren,

    If you need the path to the image for which you know the media id, use

    Media media = new Media(id); 
    string path = media.getProperty('umbracoFile').Value.ToString();

     

    Hope this helps.

    Regards,

    /Dirk

  • darren wainwright 5 posts 25 karma points
    Jan 15, 2010 @ 11:30
    darren wainwright
    0

    Hi Dirk,

    Perfect, many thanks :-D

    Is there a reference list of the media properties kicking around? rather than knocking up a script to get their names.

     

    Darren

Please Sign in or register to post replies

Write your reply to:

Draft