Array getimagesize (string $filename [, Array & $imageinfo]) gets the image size
Resource Imagecreatetruecolor (int $x _size, int $y _size) New one true color image
Resource Imagecreatefromjpeg (string $filename) creates a new image from a JPEG file or URL
BOOL Imagecopyresized (Resource $DST _image, resource $src _image, int $dst _x, int $dst _y, int $src _x, int $src _y, in T $dst _w, int $dst _h, int $src _w, int $src _h) copy part of image and resize
BOOL Imagejpeg (Resource $image [, String $filename [, int $quality]] to output the image to a browser or file in JPEG format
Copy Code code as follows:
<?php
/*
Created by <a href= "Http://www.cnphp.info" >http: Www.cnphp.info</a>
*/
/file and zoom size
//$imgfile = ' smp.jpg ';
//$percent = 0.2;
Header (' content-type:image/jpeg ');
List ($width, $height) = getimagesize ($imgfile);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = Imagecreatetruecolor ($newwidth, $newheight);
$source = Imagecreatefromjpeg ($imgfile);
Imagecopyresized ($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
Imagejpeg ($THUMB);
?>