Copied to clipboard

Flag this post as spam?

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


  • Jonas Høiby 62 posts 53 karma points
    Aug 03, 2009 @ 15:11
    Jonas Høiby
    0

    mediaPicker: getting filesize from selected files?

    any chance i can get filesize outputtet with the nodeName of my resultset? :-)

     

    with this method:

    <xsl:for-each select="umbraco.library:GetMedia(./data[@alias = $mediaFolderSelected], 'true')/node">

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 03, 2009 @ 15:22
    Thomas Höhler
    1

    If this is done with the build in datatypes file or image or via uploadfield umbraco stores some additional informations as generic properties: umbracoBytes, umbracoWidth, umbracoHeight, umbracoExtension you can get via eg: data [@alias = 'umbracoBytes']

    hth, Thomas

  • Jonas Høiby 62 posts 53 karma points
    Aug 03, 2009 @ 15:27
    Jonas Høiby
    0

    but then how would one go about reformatting it into Mb? :-)

  • Jonas Høiby 62 posts 53 karma points
    Aug 03, 2009 @ 15:42
    Jonas Høiby
    0

    found it .. :-)

     

     

    <xsl:decimal-format name="mb" decimal-separator="," grouping-separator="."/>

     

    <xsl:value-of select="format-number((((data [@alias = 'umbracoBytes']) div 1024) div 1024), '#.###,##', 'mb')"/><br />

  • dandrayne 1138 posts 2262 karma points
    Aug 03, 2009 @ 15:42
    dandrayne
    0

    You could divide the result by 1048576 and truncate the result to your required amount of decimal places.  http://www.exslt.org/math/index.html should fill any gaps in normal xslt (although I don't think they're needed).

    An interesting one though - if I had more time free I'd try to come up with some sample code, do post back if you think you'll need it

Please Sign in or register to post replies

Write your reply to:

Draft