Forum Moderators: coopster
I know that this is lame code, but I'm just trying to learn it.
Please coul'd you tell me, how to improve quality of resized images? Thanks a lot.
Here is the code
<html>
<head>
<title></title>
</head>
<body>
<?
$img_info = getimagesize("1.jpg");
$src_width = $img_info[0]; echo $src_width; if (!function_exists('imagecreatefromjpeg')) { $dst_width = $src_width / 2; $src_img = imagecreatefromjpeg("1.jpg"); $img_info2 = getimagesize("2.jpg"); </body> </html> [1][edited by: jatar_k at 1:21 am (utc) on July 14, 2005]
$src_height = $img_info;
echo $src_height;
echo "<br>fce doesn't exist :(";
}else{
echo "<br>fce exists :)<br>";
};
$dst_height = $src_height / 2;
$dst_img = imagecreate($dst_width, $dst_height);
imagecopyresized( $dst_img, $src_img, 0, 0, 0, 0,$dst_width, $dst_height,"686","520");
imagejpeg($dst_img, "2.jpg", 100);
echo $img_info2[0]." x ";
echo $img_info2[1];
?>
<br>
<img src="1.jpg">
<br>
<img src="2.jpg">
[edit reason] no personal urls thanks [/edit]
what about trying imagecreatetruecolor instead of imagecreate?
not sure if that is the right track but it might work off the top of my head.
you could take a look at this from our PHP library [webmasterworld.com]
Image upload and Thumbnail Generator [webmasterworld.com] message 29
might give you some ideas