World Wide Whale
Gender:
Posts: 153
1042 credits Members referred : 0
« on: Jan 18, 2007, 09:50:27 PM »
I want to build a photo album for my website that you will be able to click next & back on photos to view my photos. I don't want each photo to be a separate page & I don't want to use frames. Does anyone have any good ideas?
Global Moderator
Internet Junkie
Gender:
Posts: 1807
9006 credits Members referred : 6
« Reply #1 on: Jan 18, 2007, 10:45:22 PM »
you should use php for that. Your page could be photoalbum.php and the next/prev links would look something like photoalbum.php?photo=12 where the number is the photo number...
I have recently created something like that, I'll send you a link in a PM
« Last Edit: Jan 18, 2007, 10:47:00 PM by Mind_nl »
World Wide Whale
Gender:
Posts: 153
1042 credits Members referred : 0
« Reply #2 on: Jan 18, 2007, 10:47:27 PM »
That's kinda what I am looking for, how did you do it?
Global Moderator
Internet Junkie
Gender:
Posts: 1807
9006 credits Members referred : 6
« Reply #3 on: Jan 18, 2007, 10:52:53 PM »
To keep maintenance for the site owner as simple as possible the all pictures in a certain directory on the server will be shown in the photo album. To add pictures all he has to do is upload them to that directory. The script gets all .jpg files from the directory and stores them in an array
Code:
<?php $dirlist = "./images/gallery"; // leave it alone if it's the same directory // Change it if you want to view a different // directory. default value: "./"
if (is_dir($dirlist)==true )// check if directory exists { chdir( $dirlist ); $handle=opendir( ".");// open the directory $x=0; $files=array(); while (($file = readdir($handle))!==false) // while there's files to read.... { $pieces = explode (".", $file); if ($pieces[0] && $pieces[1]) // filename.ext { if (($pieces[1]=="jpg")) // add only .jpg files { $files[$x]=$file; // add it to the array. $x++; } } } } closedir($handle); //done finding files ?>
Then all you need to do is display the correct picture number from the array
« Last Edit: Jan 18, 2007, 10:55:31 PM by Mind_nl »