help improving code for getting images

Hello, I build a homepage with a slide show using the Galleriffic script. I succeed with this code:

`
<?php
$images = getImageStatistic(6, "popular", "home");
foreach ($images as $image) {
?>

class="thumb" href="<?php echo html_encode($image->getCustomImage(null, null, null, null, null, null, null, false)); ?>" title="<?php echo html_encode($image->getTitle()); ?>">

<?php } ?>
`
but I'd like to use a more proper way instead of `getImageStatistic` as:

`
$albumobj = new Album($_zp_gallery, "home");
$images = $albumobj->getImages();
foreach ($images as $image)
...
`
but in this one looks like I'm doing something wrong in the second line. So how do I call the images?
Thanks

Comments

  • acrylian Administrator, Developer
    The code you used is the right way to call the images of an album named "home" via the object model. Of course that album has to exist.

    What is wrong with using the getImageStatistics function? That is meant for these things as the object model has no functions to sort by popular at all.
  • ncs Member
    yeah, thank you for pointing it out, 'home' is an existent album of course.
    That said, it's not really wrong, but I don't need any special sort order (random, popular or whatever) and I'd like instead to show all the pics in the album. Moreover I'm trying to improve my code learning, so I was looking for a more 'right' way.
    Now, since `getImageStatistic` is working I can live with that (actually I didn't understand by your comment if the second way is ok or not).
  • acrylian Administrator, Developer
    Using the object model is the right way to get/show images from an album if outside the normal album/image context. I just tried to point out that it just gets the images on the normal sort order and also paginated if you don't set the parameter to `getImages()` accordingly.

    You did not exactly point out what your problem was.
Sign In or Register to comment.