Hi.
I have downloaded a thumbnailer script and it works fine with one picture.
Now, I have a directory full of pictures that I want thumbnailing and displayed.
When I do a recursive search through the directory it displays the first image as a thumbnail and that is it.
I guess this is because as the thumbnailer script displays the first image it sends the 'header(Content-type....blah de blah)" so when the second on comes to print the headers have already been sent and errors.
So how can i go through a directory of pictures and send thumbnails of them all to the screen?
Cheers all - been trying to figure this one out for a few hours now!!!
Ryan
//edit: this is the code i am using.
The bit to display the image from the thumbnailer:
function show()
{
//show thumb
@Header("Content-Type: image/".$this->img["format"]);
/* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
$this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
@imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);
if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") {
//JPEG
imageJPEG($this->img["des"],"",$this->img["quality"]);
} elseif ($this->img["format"]=="PNG") {
//PNG
imagePNG($this->img["des"]);
} elseif ($this->img["format"]=="GIF") {
//GIF
imageGIF($this->img["des"]);
} elseif ($this->img["format"]=="WBMP") {
//WBMP
imageWBMP($this->img["des"]);
}
}
nd my recursive thing:
<?
include("thumb.php");
$dir_name = "pics1/";
$dir = opendir($dir_name);
while ($file_name = readdir($dir))
{
$picture = $dir_name.$file_name;
if (($file_name != ".") && ($file_name != ".."))
{
$thumb=new thumbnail($picture);
$thumb->size_auto(100);
$thumb->show();
}
}
closedir($dir);
?>