How PHP generates thumbnails of pictures,
The example in this article describes how PHP generates image thumbnails. Share to everyone for your reference. Specific as follows:
We need to use the GD2 library here.
function Make_thumb ($SRC, $dest, $desired _width) {/ * Read the source image */ $source _image = Imagecreatefromjpeg ($SRC); $width = Imagesx ($source _image); $height = Imagesy ($source _image); /* Find the "desired height" of this thumbnail, relative to the desired width * /$desired _height = Floor ($height * ($des ired_width/$width)); /* Create a new, "virtual" image * /$virtual _image = Imagecreatetruecolor ($desired _width, $desired _height); /* Copy source image at a resized size * /imagecopyresized ($virtual _image, $source _image,0,0,0,0, $desired _width,$ Desired_height, $width, $height); /* Create the physical thumbnail image to its destination * /imagejpeg ($virtual _image, $dest, 83);}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/980224.html www.bkjia.com true http://www.bkjia.com/PHPjc/980224.html techarticle PHP generates thumbnail image of the method, the example of this article describes how to generate a thumbnail image of PHP. Share to everyone for your reference. Here are the following: GD2 library functio is needed here ...