php - Zoom a picture? -


//get current dimensions $width = imagesx($myimage); $height = imagesy($myimage);  $width = $width * ($zoom/100); $height = $height * ($zoom/100);  $scale = min($new_width/$width, $new_height/$height);  $new_width = ceil($scale * $width); $new_height = ceil($scale * $height);         imagecopyresampled($image_p, $myimage, 0, 0, $offset_x * -1, $offset_y * -1, $new_width, $new_height, $width, $height); 

i trying zoom picture, in fact becomes smaller , not zoomed @ all. zoom factor 113/100 = 1.13 should 13% zoomed in.

i guess want is:

//get current dimensions $width = imagesx($myimage); $height = imagesy($myimage);  $new_width = $width * $zoom / 100; //120 zoom increase image 20% $new_height = $height * $zoom / 100;  imagecopyresampled($image_p, $myimage, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 

actually first example on php.net zoom example: http://php.net/manual/en/function.imagecopyresampled.php


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -