Thanks for all of your help. After not hearing from anyone the dove into the code and after a bit of trial and error, I got some good results. I took the suggestions and the suggested code in as follows.// Function for writing a pagefooter
function pagefooter()
{
//global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
global $template_footer, $template_random_image, $template_last_image;
$custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);
if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}
//grab a single random image
$custom_pic_data_random=get_pic_data('random', $count, $album_name,0, 1, false);
//returns an array even if its only one item
$custom_pic_data_random=current($custom_pic_data_random);
//grabs the first item
$url_random=get_pic_url($custom_pic_data_random, 'thumb');
//grab the last uploaded
$custom_pic_data_last=get_pic_data('lastup', $count, $album_name,0, 1, false);
//returns an array even if its only one item
$custom_pic_data_last=current($custom_pic_data_last);
//grabs the first item
$url_last=get_pic_url($custom_pic_data_last, 'thumb');
$template_vars = array(
'{CUSTOM_FOOTER}' => $custom_footer,
'{VANITY}' => (defined('THEME_IS_XHTML10_TRANSITIONAL') && $CONFIG['vanity_block']) ? theme_vanity() : '',
'{RANDOM_IMAGE}' => "<a href=\"displayimage.php?pos=-{$custom_pic_data_random['pid']}\"><center><img src=\"$url_random\"/ class=\"image\" ></center></a>",
'{LAST_IMAGE}' => "<a href=\"displayimage.php?pos=-{$custom_pic_data_last['pid']}\"><center><img src=\"$url_last\"/ class=\"image\" ></center></a>",
);
echo template_eval($template_footer, $template_vars);
}
I then put in the {RANDOM_IMAGE} and {LAST_IMAGE} tokens in my template.
I would like to try to modify the code so that it only looks in the current album, like the Gallery Random image and views only images with the correct permissions (I have not tested this.) But I do not know where to start, but that can be left for another day.
Thanks again,
D