paste it at the end of your zen/functions.php file before ?> and add <? random_image("your album title"); ?> to your template
`
function random_image($albumtitle){
$size = '_'.zp_conf('thumb_size').'_cw'.zp_conf('thumb_crop_width').'_ch'.zp_conf('thumb_crop_height');
$albums = mysql_query("select * from ".prefix('albums')." as albums where albums.title= '".$albumtitle."'");
while($a = mysql_fetch_array($albums)) {
$album_id = $a['id'];
$album = $a['folder'];
}
$image = mysql_query("select * from ".prefix('images')." as images where images.albumid = $album_id ORDER BY RAND() LIMIT 1");
while($i = mysql_fetch_array($image)) {
$filename = $i['filename'];
$desc = $i['title'];
}
if (zp_conf('mod_rewrite') == false) {
echo '';
} else {
echo '<a href="'.WEBPATH.'/'.$album.'/'.$filename.'" title="'.$desc.'">';
}
echo '[img]'.WEBPATH.'/cache/'.$album.'/'.$filename.$size.'.jpg[/img]';
}
`