Hi there. Great photo gallery, I really love it. Like many people though I am wanting to call thumbnails of gallery images from pages outside of the Zenphoto directory (linking to the gallery). I got the the latest images working great with this code (found after trawling the forums):
<?php
$images = getImageStatistic(6, "latest");
foreach ($images as $image) {
$imageURL = getURL($image);
echo '<a href="'.$imageURL.'" title="View image: ' .
$image->getTitle() . '"><img src="' .
$image->getThumb() .
'" alt="' . $image->getTitle() . "\"/>\n";
}
?>
This gives me the latest 6 photos from the whole gallery.
This works fine, but I what I really want is to limit the latest images to those of a particular album. How would I go about doing that? It must be possible, I just don't know enough about programming in general to make it happen. Can anyone help me out?
Thanks!
Comments
Limiting the imageStatistic to an album is not possible at the moment, but sounds like a good idea. Since it's not that difficult to implement I will get this as an option into the next nightly build.
for the latest 6 in the album you are cuurently viewing:
`
<?php<br />
$photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray);
$images = getImageStatistic($photosNumber, "latest");
$album = $_zp_current_album->getFolder();
$x = 1;
foreach ($images as $image) {
$imageURL = getURL($image);
$check = substr_count($imageURL,$album);
if ($check == 1) {
$check = substr_count($imageURL,"flv");
if ($check == 0) {
echo 'getTitle() . '">getCustomImage(null, 30, 30, null, null, null, null) . '" width="30" height="30" alt="' . $image->getTitle() . ""/>";
}else{$x=$x-1;}
} else {$x=$x-1;}
if ($x++ >= 6) {
break;
}
}?>
`
and for the latest 6 images in a specific folder you can put the name in the fourth line (the name of the folder on the server's disk in caseyou have changed the title)
`
<?php<br />
$photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray);
$images = getImageStatistic($photosNumber, "latest");
$album = "specificfolder";
$x = 1;
foreach ($images as $image) {
$imageURL = getURL($image);
$check = substr_count($imageURL,$album);
if ($check == 1) {
$check = substr_count($imageURL,"flv");
if ($check == 0) {
echo 'getTitle() . '">getCustomImage(null, 30, 30, null, null, null, null) . '" width="30" height="30" alt="' . $image->getTitle() . ""/>";
}else{$x=$x-1;}
} else {$x=$x-1;}
if ($x++ >= 6) {
break;
}
}?>
`
it is not very nice code becuase it has to go trough aall your imeges and if you have many it can be a bit slow