Hello,
I have read through the forum to try to find the answer to my issue, but I can't seem to get it to work.
All I am trying to achieve is to get random images to be selected from one specific album.
The original code is this:
<?php
if (($zpfocus_showrandom) == 'single') { $sscount=1; } else { $sscount=5; }
if ((in_context(ZP_ALBUM)) || (in_context(ZP_IMAGE))) { $sstype = 'album'; $ssalbum = $_zp_current_album->getFolder(); $sstitle = gettext('Random Album Image'); } else { $sstype = 'all'; $sstitle = gettext('Random Gallery Image'); }
?>
<div id="random-wrap">
<?php printRandomImages($sscount,'',$sstype,$ssalbum,300,300,true); ?>
<div id="random-title">
<?php echo $sstitle; ?>
I changed it to this:
<?php
if (($zpfocus_showrandom) == 'single') { $sscount=1; } else { $sscount=5; }
if ((in_context(ZP_ALBUM)) || (in_context(ZP_IMAGE))) { $sstype = 'album'; $ssalbum = $_zp_current_album->getFolder()=='appliances'; $sstitle = gettext('Random Album Image'); } else { $sstype = 'all'; $sstitle = gettext('Random Gallery Image'); }
?>
<div id="random-wrap">
<?php printRandomImages($sscount,'',$sstype,$ssalbum,300,300,true); ?>
<div id="random-title">
<?php echo $sstitle; ?>
I am probably missing something very simple. Any suggestions would be appreciated. Thank-you!
Zenphoto version 1.4.2.3 [9980] (Official Build)
Current gallery theme: zpFocus_ v1.4.2.2
Comments
Note that in the 1.4.3 dev the image_album_statistics plugin's function `getImageStatistic()` has also a random image function. This at least can get random images from just one album. See the documentation in the file itself.
I only have top level albums (2), no sub-albums. I even cleared the albums cache. Is there another function to get a specific album?
Thank-you.
This is what the page source shows:
These are the albums shown on the gallery page:<img src="/advertk3/gallery/zp-core/i.php?a=appliances&i=toastmaster-stainless-steel-fry-pans.jpg&w=300&h=300&c=1&cw=300&ch=300&q=75&t=1&wmk=!" alt="toastmaster-stainless-steel-fry-pans" />
<img src="/advertk3/gallery/zp-core/i.php?a=appliances&i=toastmaster-stainless-steel-fry-pans.jpg&w=300&h=300&c=1&cw=300&ch=300&q=75&t=1&wmk=!" alt="toastmaster-stainless-steel-fry-pans" />
<img src="/advertk3/gallery/cache/baby-products/bf-goodrich-1_w300_h300_cw300_ch300_thumb.jpg" alt="BF Goodrich" />
<img src="/advertk3/gallery/zp-core/i.php?a=appliances&i=toastmaster-stainless-steel-fry-pans.jpg&w=300&h=300&c=1&cw=300&ch=300&q=75&t=1&wmk=!" alt="toastmaster-stainless-steel-fry-pans" />
<img src="/advertk3/gallery/zp-core/i.php?a=appliances&i=toastmaster-stainless-steel-fry-pans.jpg&w=300&h=300&c=1&cw=300&ch=300&q=75&t=1&wmk=!" alt="toastmaster-stainless-steel-fry-pans" />
<li class="goleft">
<h4>Appliances</h4>
<img src="/advertk3/gallery/cache/appliances/toastmaster-stainless-steel-fry-pans_160_thumb.jpg" alt="Appliances" />
<span class="front-date">Apr 20, 2012</span>
<p class="front-desc">
tes test test »
</p>
<li class="goright">
<h4>Baby Products</h4>
<img src="/advertk3/gallery/cache/baby-products/bf-goodrich-1_160_thumb.jpg" alt="Baby Products" />
<span class="front-date">Dec 19, 2010</span>
<p class="front-desc">
test test test »
</p>
Thank-you.
I think I have figured out the answer to my question.
I changed the code to this:
'<?php
if (($zpfocus_showrandom) == 'single') { $sscount=1; } else { $sscount=5; }
if ((in_context(ZP_ALBUM)) || (in_context(ZP_IMAGE))) { $sstype = 'album'; $ssalbum = 'appliances'; $sstitle = gettext('Random Album Image'); } else { $sstype = 'album'; $ssalbum = 'appliances'; $sstitle = gettext('Random Gallery Image'); }
?>
<div id="random-wrap">
<?php printRandomImages($sscount,'',$sstype,$ssalbum,300,300,true); ?>
<div id="random-title">
<?php echo $sstitle; ?>'
Seems to work. Thank-you for your time!
So your change is exactly what you wish to do.