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 enter image description here

$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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -