Image Size in Album view

artem

Joined: 2005-01-25
Posts: 1
Posted: Tue, 2005-01-25 04:59

Hi,

it looks like quite stupid question, but I couldn't find anything in "G2 Support" using search.

I would like to show Image Size value (in Kb) under each thumbnails in Album page (now there are only caption, date, views fields).

(JFYI: I also have tried to show Image size in Summary and Detailed views, but exif field Image Size shows value in the useless form of "Large", "Medium", "Small" size)

----
Gallery version: 2.0-alpha-4
Webserver (with version): Apache/1.3.27
Datatabase (with version): mysql 3.23.56
PHP version (eg 4.2.1): 4.1.2
Graphics Toolkit(s): GD 1.6.2, ImageMagick-5.4.3.11
Operating system: Red Hat 7.1
Web browser/version: Firefox 1.0, IE 6.0

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-01-25 06:06

try making a local template for layouts/matrix/templates/albumBody.tpl and find where it shows {$child.summary}, etc.. you can put {$child.size} somewhere nearby, though that will be in bytes.

 
Panu

Joined: 2002-11-11
Posts: 37
Posted: Tue, 2005-01-25 10:20
mindless wrote:
try making a local template for layouts/matrix/templates/albumBody.tpl and find where it shows {$child.summary}, etc.. you can put {$child.size} somewhere nearby, though that will be in bytes.

I quess if it's normal smarty stuff you can use math operators in it?

{$child.size / 1024|string_format:"%.2f"}

to get it in kb?

 
doctormord
doctormord's picture

Joined: 2005-01-26
Posts: 63
Posted: Wed, 2005-01-26 17:50

This will give back an error.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2005-01-26 20:55

You can use the {assign} Smarty tag to do math, see [url={assign var="foo" value="`$foo+$bar`"}]this page[/url]

Off the top of my head:

{assign var="size" value="`$child.size / 1024`"}
{$size|string_format:"%.2f"}
 
doctormord
doctormord's picture

Joined: 2005-01-26
Posts: 63
Posted: Thu, 2005-01-27 19:03

i get a 0.00 Bytes from this math. :( And how to set it up that it is only shown, when there are only images in there not when subalbums shown.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-01-27 20:37

find where it shows "Album:"
you'll see an {if} around it.. do that, but with !.
{if !$child.canContainChildren}

 
doctormord
doctormord's picture

Joined: 2005-01-26
Posts: 63
Posted: Fri, 2005-01-28 19:50

Great mate, that works. :) But the math wont give me a valid result? Its always 0.00

Edit:

{assign var="size" value="`$child.size / 1024`"} 
{$size|string_format:"%.2f"} 

must be:

{assign var="size" value="`$child.size/1024`"} 
{$size|string_format:"%.2f"} 

to get it work. :)