Copied to clipboard

Flag this post as spam?

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


  • David 3 posts 23 karma points
    Aug 24, 2011 @ 19:29
    David
    0

    images (mediaType) as node or document?

    Hello,

    I'm trying to access the file path of an image programmatically for a custom data type.

    I'm tried both document(id) and node(id) neither of which return the 'umbracoFile' property can anyone help?

    David

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 24, 2011 @ 20:09
    Fuji Kusaka
    0

    Hi David,

    What you can do is try to make a test for the file and from there if its present get the XSLT to write the value. I presume you are using the upload field in your documentType for the image right?

    Or you could try something like:

     <xsl:for-each select="$currentPage">      
         <xsl:element name="img">
          <xsl:attribute name="src">
           <xsl:value-of select="umbraco.library:GetMedia(imageAlias, 'true')/umbracoFile" />
          </xsl:attribute
        </xsl:element>

      </xsl:for-each>

     

  • Bobby 43 posts 63 karma points
    Aug 25, 2011 @ 14:49
    Bobby
    0

    Hi David,

     

    I have done a similar type.hope thsi helps you.

    Created a MediagalleryItem type and added the following properties to it.

    mediatitle(TextString), mediaSource(mediaPicker), mediaDescription(textboxmultiple) .

    Here is the XSLT i used.

    <xsl:variable name="mediaFolderId" select="number($currentPage/imageFolder)" />

    <ul class="imagegallery">
         <xsl:for-each select="umbraco.library:GetMedia($MediaId, 1)/GalleryMediaItem">

    <img class="rImg">
            <xsl:attribute name="src">
              <xsl:variable name="tImage" select="mediaSource" />
              <xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" />
            </xsl:attribute>

    </img>

      </xsl:for-each>
        </ul>

     

    hope this is what you are looking and helps you

     

    Phani

  • David 3 posts 23 karma points
    Aug 25, 2011 @ 14:58
    David
    0

    I was looking for the C# syntax, however I've solve the issue now, but thank you for your help.

     

    David

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies