Community

How to display ALL album images using Gallery extra?

Is there a way to show all images from all albums using the Gallery extra?
Thanks for any help

You want all images from each album in each page or from all albums at once?

I haven’t used the Gallery extra in a long time and I haven’t tested this but you could make a snippet containing something like this:

<?php
$gallery = $modx->getService(
    'gallery',
    'Gallery',
    $modx->getOption('gallery.core_path', null, $modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties
);
if (!($gallery instanceof Gallery)) return '';

$images = $gallery->modx->getCollection('galItem');
$output = '';
foreach($images as $image) {
    $imageArray = $image->toArray();
    $output .= $modx->getChunk('yourChunkTplName',$imageArray);
}
return $output;

Yes that’s right. I’m trying to get it to work with the isoptope filter
Thanks for the snippet but i can’t seemn to get it to work unless i’m doing something wrong.

Did you change the chunk name to the one you’re using?
any errors in the log?