Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to create IMG tags from a folder of pictures' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to create IMG tags from a folder of pictures
Authored by: Telluride on Dec 23, '04 10:28:43AM
try this. php's image manipulation functions are pretty good. You can even create thumbnails, resize-images, etc on the fly.

<?
# index.php
# $dir is the dir that holds your images
$dir = '.';
$ary = array();
   if ($dh = opendir($dir)) {
       while (($file = readdir($dh)) !== false) {
                if (!is_dir($file) && !strstr($file,'index')) {
                        echo "<img src=\"$file\"/><br>";
                }
       }
       closedir($dh);
   }
?>


[ Reply to This | # ]
A script to create IMG tags from a folder of pictures
Authored by: Telluride on Dec 23, '04 10:30:30AM
OOPS! Wrong paste of code! Corrected version:

<?
# index.php
# $dir is the dir that holds your images
$dir = '.';
$ary = array();
   if ($dh = opendir($dir)) {
       while (($file = readdir($dh)) !== false) {
                if (!is_dir($file) && !strstr($file,'index')) {
                        list($h,$w,$type,$dimensions) = getimagesize($file);
                        echo "<img src=\"$file\" $dimensions>\n<br>\n";
                }
       }
       closedir($dh);
   }
?>


[ Reply to This | # ]