Table of contents
  1. 1. Usage Restrictions
  2. 2. Result
  3. 3. Samples
page.Files: map

The files attached to the current page.

Usage Restrictions

1.9.1 or later

Result

A map of the current page's file to its file link.

Samples

  Output

to get a page's subpage' info:

{{ page.files}} 

 

{ "metaCopyright.jpg" : "local://844e2466b1ab4bd8a531ce589bfb61a1/deki/$file", "metaRating.jpg" : "local://844e2466b1ab4bd8a531ce589bfb61a1/deki/$file" }

retrieve properties of the first image by converting the map to a list
The list contains a key and value argument for each map element, so to access the file properties you need to add "value"

{{var myList = map.keyvalues(page.files);
myList[0].value;
}}
{ api : "http://developer.mindtouch.com/@api/deki/files/2393", author : "local://844e2466b1ab4bd8a531ce589bfb61a1/deki/$user", date : "Thu, 08 May 2008 21:46:41 GMT", description : "local://844e2466b1ab4bd8a531ce589bfb61a1/deki/$filedesc", editsummary : nil, imageframes : 1, imageheight : 100, imagewidth : 370, mime : "image/jpeg", name : "metaRating.jpg", page : "local://844e2466b1ab4bd8a531ce589bfb61a1/deki/$page", size : 19422, thumburi : "http://developer.mindtouch.com/@api/deki/files/2393/=metaRating.jpg?size=thumb", uri : "http://developer.mindtouch.com/@api/deki/files/2393/=metaRating.jpg", webviewuri : "http://developer.mindtouch.com/@api/deki/files/2393/=metaRating.jpg?size=webview" }

retrieve some properties of the first image

{{var myList = map.keyvalues(page.files);
myList[0].value.description;<br/>
myList[0].value.date;<br/>
myList[0].value.author.name;<br/>

web.image(myList[0].value.uri);<br/>
}}

 

Rating
Thu, 08 May 2008 21:46:41 GMT
vivieny

 

Tag page (Edit tags)

    Files 2

    FileSizeDateAttached by 
     metaCopyright.jpg
    Copyright
    21.31 kB21:46, 8 May 2008vivienyActions
     metaRating.jpg
    Rating
    18.97 kB21:46, 8 May 2008vivienyActions
    Viewing 1 of 1 comments: view all
    I want to expand this script to display an image that matches a certain description
    Posted 00:11, 8 Aug 2009
    Viewing 1 of 1 comments: view all
    You must login to post a comment.