[semi-solved]Gallery: number of images in folders

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
konsument
Forum Members
Forum Members
Posts: 137
Joined: Thu Oct 26, 2006 9:20 am
Location: Dresden - Saxony - Germany

[semi-solved]Gallery: number of images in folders

Post by konsument »

Hi together,

is there a way to get the number of images of albums in a subfolder?

Theres allready a feature request postet some time ago: http://dev.cmsmadesimple.org/feature_request/view/5400

Anybody an idea how to solve this problem?
Last edited by konsument on Wed Jan 26, 2011 2:16 pm, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Gallery: number of images in folders

Post by Jos »

The page where you edit a Gallery-template contains an icon which shows you all the template variables you can use with Gallery. You can find it right underneath the first template field.

The same list with variables is also available in the Gallery documentation: http://wiki.cmsmadesimple.org/index.php ... _variables

At this time the number of images is only available in the subgallery itself.
konsument
Forum Members
Forum Members
Posts: 137
Joined: Thu Oct 26, 2006 9:20 am
Location: Dresden - Saxony - Germany

Re: Gallery: number of images in folders

Post by konsument »

ok thanks for the info.

Anyway, Ive build my own quick and dirty udt to solve this problem:

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/Gallery/';
$albumdir = $params['gallerydir'];

$d = opendir($dir . $albumdir);
$count = 0;

while(($f = readdir($d)) !== false)
if(ereg('.jpg$', $f))
++$count;
closedir($d);

$finalamount = $count/2;

echo "$finalamount";
The call in the Gallery template is:

Code: Select all

{foreach from=$images item=image}
{if $image->isdir}
{tagname gallerydir=$image->filename} images
{/if}
{/foreach}
This works fine for me, because Ive only one level galleries

Im no programmer at all - Im just happy to solve it for me with this :)
Post Reply

Return to “Modules/Add-Ons”