Posted by Krustov on 10/28/06 14:38
<comp.lang.php>
<Krustov>
<Sat, 28 Oct 2006 15:00:49 +0100>
<MPG.1fad72d49049c05b98a123@news.newsreader.com>
> Its usually better to scan the folder for image files , The following
> doesnt create the thumbnails for you - but it will get you started .
>
The following php code being a bit better as it will only display files
that have the .jpg extension .
<?php
$batman=0;
$dir="chatroom/images";
$joker=opendir($dir);
while (false!==($boywonder=readdir($joker)))
{
$files[]=$boywonder;
$batman=$batman+1;
}
$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen($demo);
$penguin=substr($demo,$riddler-4,4);
if ($penguin==".jpg")
{
$link="$dir" . "/" . "$demo";
print "<a href=$link>$demo</a><br>";
}
$temp=$temp+1;
}
?>
--
www.phpchatroom.co.uk
[Back to original message]
|