PHP upscale an image? -
i new php , trying learn image upscaling. can please show me how can upscale image size? example, re-size following image while keeping aspect ratio. if can done, can please show me example
$source_image = imagecreatefromjpeg("osaka.jpg"); $source_imagex = imagesx($source_image); $source_imagey = imagesy($source_image); $dest_imagex = 300; $dest_imagey = 200; $dest_image = imagecreatetruecolor($dest_imagex, $dest_imagey);
poor quality, fast:
imagecopyresized($dest_image, $source_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $source_imagex, $source_imagey);
best quality, slow:
imagecopyresampled($dest_image, $source_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $source_imagex, $source_imagey);
Comments
Post a Comment