Hi Simon,

Or you can use pure freemarker:

[#assign doc=mgnl.getContentByUUID("dms",content.downloadFileDmsUUID)! /]
Type: ${doc.type}
[#assign docsizeKb=((docsize/1024))?string("0.##")/]
[#assign docsizeMb=((docsize/1024)/1024)?string("0.##")/]
Size: [#if docsize<1048576]${docsizeKb} kB[#else]${docsizeMb} MB[/#if]

That code still needs some "protection" in case content.downloadFileDmsUUID is 
not set, etc... but it should give you the general idea.

Regards from Vienna,

Richard

Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Simon Goodchild
Gesendet: Mittwoch, 01. August 2012 23:26
An: Magnolia User-List
Betreff: [magnolia-user] Getting file size and type for objects in the DMS 
repository?

Hi,

I'm am looking for a way to access the file size and type of objects that are 
stored in the DMS repository. The use case is that I have a paragraph setup to 
link to a DMS object, and want to display useful file information automatically 
alongside the document link. I've looked through all the documentation and APIs 
that I can find, but nothing seems to cover this requirement (I have code for 
website repository objects, but this doesn't work fro DMS). Is this possible, 
and if so does anybody have any example code or pointers on which APIs to look 
at to achieve this?

For reference, I'm working with a Magnolia 4.1 system, but can switch to any 
later version if that adds support for what I need.

Many thanks for any help you can give me,

Simon

________________________________
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: 
<[email protected]<mailto:[email protected]>>
----------------------------------------------------------------


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to