OK. Something strange is going on here. I am using the Effervescence theme with my newly created database. The link is here (you may have to refresh a few times to get a failed image query). I have shifted a few subalbums around in the folder structure, but I have dumped the cache and ran garbage collection. Occasionally, the random function will reference images that don't exist (intermittent) like it's looking for "stale" db references in its SQL queries. Might anyone have any suggestions as to how to correct it? I haven't made many changes to the DB so far (other than the hit counts and ratings), nor entered any custom titles or descriptions yet. Also of note is the fact that the same thing happens on my wordpress blog using Zenshow's random function as well (see here). See below for the code I am using. Any help would be most appreciated, as I'm stumped. Thanks!
Here is the line I am running, straight from the theme:
`<?php $randomImage = getRandomImages(); $randomImageURL = getURL($randomImage); print "<img src='".$randomImage->getCustomImage(1000, 620, 180, 620, 180, 300, 300)."' alt='".$randomImage->getTitle()."' />"; ?>`
Here are the functions used to query the DB:
`// Get Random Images
function getRandomImages() {
$result = query_single_row('SELECT '.prefix("images").'.filename,'.prefix("images").'.title, '.prefix("albums").'.folder FROM '.prefix("images").' INNER JOIN '.prefix("albums").' ON '.prefix("images").'.albumid = '.prefix("albums").'.id ORDER BY RAND() LIMIT 1');
$image = new Image(new Album(new Gallery(), $result['folder']), $result['filename']);
return $image;
}
function getURL($image) {
if (zp_conf('mod_rewrite'))
{
return WEBPATH . "/" . urlencode($image->getAlbumName()) . "/" . urlencode($image->name);
}
else
{
return WEBPATH . "/index.php?album=" . urlencode($image->getAlbumName()) . "&image=" . urlencode($image->name);
}
}`