PHP crop an image, which is generally the imagecopyresampled () function. By default, the image is cut from the upper left corner. After reading the code of cutting the image from the middle corner on the Internet, it is very complicated. In fact, you don't have to worry about this, just define the two horizontal and vertical coordinate strings in imagecopyresampled. The code in this article is as follows: crop from 1/3 width, Set width to 200, and height.
PHP crop an image, which is generally the imagecopyresampled () function. By default, the image is cut from the upper left corner. After reading the code of cutting the image from the middle corner on the Internet, it is very complicated. In fact, you don't have to worry about this, just define the two horizontal and vertical coordinate strings in imagecopyresampled. The code in this article is as follows: crop from 1/3 width, Set width to 200, and height.
PHP crop an image, which is generallyimagecopyresampled()Function, which is switched from the upper left corner by default. After reading the code for cutting graphs from the middle corner on the Internet, it is very complicated. In fact, this is not necessary, just define the two horizontal and vertical coordinate strings in imagecopyresampled.
Code effect of this article: crop from 1/3 width, Set width to 200, and the height remains unchanged. (If you want to cut from a certain proportion of the height and width, refer to this method)
Cut_img_from_center is coded by xiaohudie. Any posts here is one hundred percent original, so please keep my link so as not to hurt this pretty girl