Hi,
here I've an example for dynamicly resizing jpg-files. How can do this
for gif-files?
Regards,
Ruprecht
<?
mysql_connect("localhost","root");
$result=mysql_db_query("chorportal","SELECT * FROM dirigent WHERE
ID='$chorid'");
while ($row = mysql_fetch_object($result))
{
if (!$row->Foto)
{
$source = imagecreatefrompng('leer.png');
$ctl = 1;
}
else
{
$source = imagecreatefromjpeg($row->Foto);
}
}
$orig_width = imagesx($source);
$orig_height = imagesy($source);
$size_limit = 70;
if ($orig_height > $oirg_width)
$scaledown = $orig_height;
else
$scaledown = $orig_width;
$newscale = $size_limit / $scaledown;
$new_w = abs($orig_width * $newscale);
$new_h = abs($orig_height * $newscale);
$base_image = imageCreate($new_w, $new_h);
imagejpeg($base_image,'temp.jpg');
if ($ctl != 1)
{
$image = imagecreatefromjpeg('temp.jpg');
$imagetoresize = imagecreatefromjpeg('chor1_gr.jpg');
imagecopyresampled($image,$imagetoresize,0,0,0,0,$new_w,$new_h,$orig_width,$orig_height);
imageJpeg($image,'chor.jpg',100);
unlink('temp.jpg');
echo "<img src='chor.jpg' >";
}
else
{
echo "<img src='leer.png'>";
}
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php