This article mainly introduces the PHP image scaling implementation method, the need for friends can refer to the following
PHP Basic Exercise-image scaling: Code as follows: <?php /** * Image zoom. / function Imagezoom ($filename, $w, $h) { /Arguments meaning * * /* $filename: The source of the name * */ * $w: Want get the I Mage ' s width */ /* $h: You want get the Imgage ' s height */ $arr = GetImageSize ($filename); $SRC _w = $arr [0]; $SRC _h = $arr [1]; $SRC _t = $arr [2]; /*1 = gif,2 = jpg,3 = png,4 = swf,5 = psd,6 = bmp,7 = TIFF (Intel byte order) = TIFF (Motorola byte order), 9 = jpc,10 = jp2,11 = jpx,12 = jb2,13 = SWC, = iff,15 = wbmp,16 = xbm*/ $SRC _m = $ Arr[' MIME ']; $SRC _img = Imagecreatefromjpeg ($filename); if (($w/$src _w) > ($h/$src _h)) { $bili = $h/$src _h; &NB Sp else { $bili = $w/$src _h; } $DST _w = $src _w * $bili; $DST _h = $src _h * $bili; $DST _img = Imagecreatetruecolor ($dst _w, $dst _h); imagecopyresampled ($dst _img, $src _img, 0, 0, 0, 0, $dst _w, $dst _h, $src _w, $src _h); header ("content-type:{$src _m}"); switch ($src _t) { Case 1: &NBSP ; $imgout = "Imagegif"; break; Case 2: $imgout = "image JPEG ";   break; Case 3: $imgout = "image PNG "; break; default: echo "the type Was wrong! "; break; } $DST _filename = "S_". $filename; $imgout ($dst _img, $dst _filename); Imagedestroy ($dst _img); } $filename = ' gg.jpg '; Imagezoom ($filename, 100, 200); Core:<1> Note how scaling is achieved, although the resulting picture may be somewhat different from what is expected, but at least the scaling is guaranteed. <2> type of control.