Random Images from album

Hi,

I am trying to print random images from my 4 Albums and my code work well.

But I want to print only 6 or more images randomly, how can I do this thing please?

Here my code to print images each refesh:

<?php
while (next_album()):
$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
?>
<div class="blockfolio" style="margin-right:10px;">
<div class="blockfolio_img">
" class="photo" >
<img width='309' height='179' src='<?php echo $randomImage->getCustomImage('',309,179,'','',300,300);?>'
alt='<?php echo $randomImage->getTitle();?>'/>


<div class="heart">
<img src="<?php echo $_zp_themeroot; ?>/images/heart.jpg" width="11" height="10" alt="heart" /> 156
</div>
</div>

<h2><?php echo 'coucou';//getAnnotatedImageTitle(); ?></h2>


</div>
<?php endwhile;?>

Thank you

Comments

  • acrylian Administrator
    Your code is not escaped correctly so we cannot review it. In any case you need to get familiar with the object model.

    Zenphoto 1.4.3's (and therefore the beta) has a random images options within the image_album_statistics function (the base getImageStatistics() has but there is no wrapper function itself).
  • deep Member
    Hi,
    Currently I'm using Zenphoto 1.4.2.4, can you tell me what's wrong with this code?
  • acrylian Administrator
    From what I can see you cannot use the next_album loop. Use the object model and a custom loop or use the functions to create "current" images and albums.
  • deep Member
    Hmm, my html code is in the while loop...
  • acrylian Administrator
    which is the next_album loop which is why it does not work as you expect. There is also a random image from an album function. Please see the doc of the template functions.
  • deep Member
    Hi,
    Ok I will see soon.
    Thank you
Sign In or Register to comment.