Hello I have alot images store in one folder and i want to display all images in that folder. 1. display 25 images each pages 2. display the thumail or the size 75w x 75h 3. when the user click on the thumail will display full size image i found this script..from celerondude.com however the script only support jpg..i am looking support both jpg and gif or other extension thanks advance
if ($dir = @opendir("/tmp")) { while (($file = readdir($dir)) !== false) { echo "<a href=\"big.php?file=" . $file . "\"><img src=\"" . $file . "\" width=\"75\" height=\"75\"></a>\n"; } closedir($dir); } PHP:
First Thank for reply Second if my folder name "img" so i replace the ("/img")) ? if i do that i will get a blank page code: Thanks
if img folder is relative to the current folder, try removing "/" i.e use ("img") instead of ("/img") Also you need to strip out (.) and (..) files.
readdir() will return the . and .. entries you can strip out . and .. if ($file != "." && $file != "..") { echo "<a href=\"big.php?file=" . $file . "\"><img src=\"" . $file . "\" width=\"75\" height=\"75\"></a>\n"; } PHP:
This is work fine Last question: Now i need to display 10 image in a row and in 5 col (50 image total in one page) everything over that go to another page, and another page and so on... Thanks advance
I am in the process of creating an IMAGE upload script, it might just do what you want and you can learn from it. Peace,