By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,340 Members | 1,715 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,340 IT Pros & Developers. It's quick & easy.

image resampling

P: n/a
That function:

function
resizeImage($defsize,$newsize,$dX,$dY,$bgcolor,$ne wname,$fileformat,$fQuality)
{
$firstimage = imagecreate($defsize[0],$defsize[1]);
imagecolorallocate($firstimage, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
$newimage = imagecreatetruecolor($defsize[0],$defsize[1]);
imagecopy ($newimage,$firstimage,0,0,0,0,$defsize[0],$defsize[1]);
$image = imagecreatefromstring ($GLOBALS['filestr']);
//$image = imagecreatefromjpeg($newname);

imagecopyresampled($newimage,$image,$dX,$dY,0,0,$n ewsize[0],$newsize[1],$image,
$GLOBALS['tmpsize'][1]);
if ($fileformat == "png") {
imagepng ($newimage, $newname);
$newtype = "image/x-png";
} else {
imagejpeg ($newimage, $newname, $fQuality);
$newtype = "image/pjpeg";
}
imagedestroy ($newimage);
return $newtype;
}

give me bad results, quality is very bad

- how to improve that-
- why $image = imagecreatefromstring ($GLOBALS['filestr']); is that
the best way ?
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
probably the reason can be here - imagecopy()
try to change it to imagecopyresampled() because imagecopyresampled()
do the same thing but smoothly

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.