View Full Version : selectMenuGallery

11 November 2003, 04:56 PM
Hye CGtalker,
I recently coded a php script that you can use to generate a simple image viewer diplaying the pictures (jpg and gif) from the folder where this script is located. It makes all for you automaticaly. How? simply copy this code and paste it in a text file calling "index.php".
That's better than a plain server folder sort! Use it, it's a gift !
An example here (

<table border=0>
<select onChange="document.images['imageSelectMenu'].src=this.options[this.selectedIndex].value" >
<option value="" selected> Selection </option>

// selectMenuGallery by Nicolas d'Haussy
// generate a navigation with select menu to display the picture from the folder where this script is located

// Lists the images of this directory and build the select menu.
while ($file=readdir($session)) {

if (is_file($file)) {

// Check if the file is an image
$extension = strtolower(substr(strrchr($file, "." ), 1 ));
if ($extension == "jpg" || $extension == "jpeg" || $extension == "gif") {

// Build the select menu
$selectMenuItems .= (" <option value=\"" . $file . "\">" . $file . "</option>\n");
// Then display the dynamic menu items
echo ($selectMenuItems);
<IMG NAME="imageSelectMenu" src="" BORDER="0">

CGTalk Moderation
01 January 2006, 03:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.