image resampling

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alexandre damiron

    #1

    image resampling

    That function:

    function
    resizeImage($de fsize,$newsize, $dX,$dY,$bgcolo r,$newname,$fil eformat,$fQuali ty)
    {
    $firstimage = imagecreate($de fsize[0],$defsize[1]);
    imagecoloralloc ate($firstimage , $bgcolor[0], $bgcolor[1], $bgcolor[2]);
    $newimage = imagecreatetrue color($defsize[0],$defsize[1]);
    imagecopy ($newimage,$fir stimage,0,0,0,0 ,$defsize[0],$defsize[1]);
    $image = imagecreatefrom string ($GLOBALS['filestr']);
    //$image = imagecreatefrom jpeg($newname);

    imagecopyresamp led($newimage,$ image,$dX,$dY,0 ,0,$newsize[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 = imagecreatefrom string ($GLOBALS['filestr']); is that
    the best way ?
  • Sergey.Romanov@gmail.com

    #2
    Re: image resampling

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

    Comment

    Working...