Classic PHP thumbnail generation program, based on GD library, can specify a generated path and generate a wide high detail method of generating a target: Save the following code as a resize.php test in the PHP environment that supports the GD library.
$ Filename = "image_name"; // Generate the width of the picture $ resizeWidth = 400; // Generate the height of the picture $ ResizeHeight = 400; // Generate the path $ uploadDir = "c: / winnt / temp"; function ResizeImage ($ MAXWIDTH, $ MAXHEIGHT, $ Name) {Global $ UPLOADDIR; $ width = imagesX ($ IMAGESY); $ HEIGHT = ImageESY ($ MAXWIDTH && $ Width> $ MAXWIDTH) | | ($ maxheight && $ height> $ maxheight)) {if ($ maxwidth && $ width> $ maxwidth) {$ widthratio = $ maxwidth / $ width; $ RESIZEWIDTH = true;} if ($ maxheight && $ height> $ maxheight ) {$ heightratio = $ maxheight / $ height; $ RESIZEHEIGHT = true;} if ($ RESIZEWIDTH && $ RESIZEHEIGHT) {if ($ widthratio <$ heightratio) {$ ratio = $ widthratio;} else {$ ratio = $ heightratio; }} elseif ($ RESIZEWIDTH) {$ ratio = $ widthratio;} elseif ($ RESIZEHEIGHT) {$ ratio = $ heightratio;} $ newwidth = $ width * $ ratio; $ newheight = $ height * $ ratio; if (function_exists ( "imagecopyresampled")) {$ newim = imagecreatetruecolor ($ newwidth, $ newheight); imagecopyresampled ($ newim, $ im, 0, 0, 0, 0, $ newwidth, $ newheight, $ width, $ height);} else { $ newim = imagecreate ($ newwidth, $ newheight); ImageCopyResized ($ NE WIM, $ IM, 0, 0, 0, 0, $ NewWidth, $ Newheight, $ Width, $ HEIGHT);} ImageJPEG ($ NEWIM, $ UPLOADDIR. $ Name. "" .jpg "); ImageDestroy ($ NEWIM); Else {ImageJPEG ($ IM, $ UPLOADDIR. $ Name. ".jpg");}}} f ($ _ files ['Image'] ['size']) {= f ($ _ files ['Image'] ['Type '] == "image / pjpeg") {$ = imagecreatefromjpeg ($ _ files [' image '] [' TMP_NAME ']);} elseif ($ _ files [' Image '] [' type '] == "Image / X-PNG ") {$ = imagecreateFromPng ($ _ files ['image'] ['tmp_name']);} elseif ($ _ files ['image'] ['