Copied to clipboard

Flag this post as spam?

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


  • rajeev 18 posts 38 karma points
    Feb 22, 2011 @ 08:17
    rajeev
    0

    get media details e.g.its size using the path to image in xslt

    I have the access to path of an image in xslt. How I can get the its size in the xslt?

     

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Feb 22, 2011 @ 09:50
    Chriztian Steinmeier
    0

    Hi rajeev,

    You have the following info available on default Image nodes in Media:

    • umbracoFile - path to file
    • umbracoWidth - width of image
    • umbracoHeight - height of image
    • umbracoExtension - filetype (e.g. "jpg" or "png")
    • umbracoBytes - size of file in bytes

    /Chriztian

     

  • rajeev 18 posts 38 karma points
    Feb 22, 2011 @ 09:53
    rajeev
    0

    correct in a xslt where I want to show this detail, I have only path to image which specified via xslt parameter

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2011 @ 09:59
    Jeroen Breuer
    0

    If you want all the media details in the umbraco.config xml you can use my package the Digibiz Advanced Media Picker. You can also just store the id like with the normal media picker, but you can also have multiple items in 1 picker.

    Example of umbraco.config:


    Jeroen

  • rajeev 18 posts 38 karma points
    Feb 22, 2011 @ 10:11
    rajeev
    0

     Can you please suggest me how should be xslt to show its media image id.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2011 @ 10:18
    Jeroen Breuer
    0

    Here is an xslt sample I use with the Digibiz Advanced Media Picker:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
    
    
    <xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    
      <!--In "classic" only 1 id can be stored.-->
      Classic:<br/><br/>
      <img src="{umbraco.library:GetMedia($currentPage/classic, 0)/umbracoFile}" height="150px;" />
    
      <br/><br/>
    
      <!--In "new" multiple media items can be stored with the full media xml.-->
      New:<br/><br/>
      <xsl:for-each select="$currentPage/new/DAMP[@fullMedia]/mediaItem/Image">
        <img src="{umbracoFile}" height="150px;"/>
        <br/>
        <br/>
      </xsl:for-each>
    
    </xsl:template>
    
    </xsl:stylesheet>

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2011 @ 10:20
    Jeroen Breuer
    0

    And here you can watch a movie on how to use it: http://screenr.com/TEY.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft