I'm happy you like it mqcarpenter.
Thanks for spotting the error in the include.
Here is a new version of the script that allows to display a chosen number of photos. Photos are now picked up randomly even in one album.
For example get_photo?album=6&nb=4 will display 4 photos from album 6.
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery - RSS Feed //
// ------------------------------------------------------------------------- //
// Copyright (C) Dr. Tarique Sani //
// http://tariquesani.net/ //
// Adapted by djib to display a random photo - http://djib.biz //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation //
// ------------------------------------------------------------------------ //
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
//How many items you want to show in your get_photo script
if(isset($_GET['nb'])) {
$thumb_per_page=$_GET['nb'];
} else {
$thumb_per_page = 4;
}
$thumb_count = 4;
$lower_limit = 0;
if(isset($_GET['album'])){
$album = $_GET['album'];
}
//If it is a numeric album get the name and set variables
if ((is_numeric($album))){
$album_name_keyword = get_album_name($album);
$CURRENT_CAT_NAME = $album_name_keyword['title'];
$ALBUM_SET = "AND aid IN (".(int)$_GET['album'].")".$ALBUM_SET;
//Set the album to last uploaded
$album = 'random';
}
//If the album is not set set it to lastup - this is the default
if(!isset($album)){
$album = 'random';
}
//Changes these to point to your site if the following is not giving correct results.
$link_url = $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
$image_url = $CONFIG['ecards_more_pic_target']."albums/";
$data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);
foreach($data AS $picture) {
$thumb_url = "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";
$description = '<a href="' . $link_url . $picture['pid'] . '"><img src="' . $thumb_url . '" alt="Photo aléatoire"/></a>';
echo $description;
}
?>