You are here: How do you display new images created with PHP? « All PHP « IT news, forums, messages
How do you display new images created with PHP?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация