array in album.tpl

arnthorsnaer

Joined: 2005-11-01
Posts: 4
Posted: Mon, 2005-11-28 08:37

I am configuring the album.tpl to show some information on the file, but my guessing abilities are pretty poor when it comes to the $child array.

Is there a reference available of what the array contains?
How can i evalutate the item's filetype (if then else), for example weather it is a jpg or zip and etc?

And lastly, i found $child.size, which gives me the size in bytes, is there a way to reference that in mb or divide and round it with smarty?

thanks, regards, Arnþór

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-28 10:46

no there isn't such a reference. i just added a note on http://codex.gallery2.org/index.php/Talk:Gallery2:Tpl_Reference#List_of_.24theme.item_.2F_.24child_properties that we should add something like this.

a $child, is an item. there are albumItems (albums) and dataItems (imagess, zips, ...just files).
to check whether it is an album or a file, you can check {if $child.canContainChildren} obviously, if true, it's an album, else a file (data item).

you could check $child.mimeType to find out whether it is a zip or an image.

you can access any variable of http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryDataItem.html

with $child.variableName