|
Posted by Flaming Corncob on 09/02/06 17:38
Below is the code I've got:
$data=getimagesize($src);
$height=150;
$width=$data['0']*(($height)/$data['1']);
if($data['mime']=="image/gif")
{
$image=@imagecreatefromgif($src);
}
else if($data['mime']=="image/jpeg")
{
$image=@imagecreatefromjpeg($src);
}
$thumb=imagecreatetruecolor($width, $height);
imagecopyresized($thumb, $image, 0, 0, 0, 0, $width, $height,
$data['0'], $data['1']);
header("Content-type: ".$data['mime']);
if($data['mime']=="image/gif")
{
imagegif($thumb);
}
else if($data['mime']=="image/jpeg")
{
imagejpeg($thumb);
}
It works. It takes the $src and creates a smaller thumb nail image and
outputs it to the browser. There's a problem, though. Printing it this
way I can't seem to print out more than one image in a gallery. If I
want to print.. say.. 12 out of 40 thumb nail images to the browser in a
formatted page... using header() seems to not be the way to go. Is there
any way to "output" the same image to the browser without having to use
header()?
Navigation:
[Reply to this message]
|