image resampling

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

That function:

   $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);

   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 ?

Re: image resampling

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

Site Timeline