New file index.php, you need to have a picture under the statistics directory for q.jpg (can change the name of the picture according to the source)
The source code is as follows:
<?php
$filename = "q.jpg";
$per =0.3;
List ($width, $height) =getimagesize ($filename);
$n _w= $width * $per;
$n _h= $height * $per;
$new =imagecreatetruecolor ($n _w, $n _h);
$img =imagecreatefromjpeg ($filename);
Copy part of the image and adjust the
imagecopyresized ($new, $img, 0, 0,0, 0, $n _w, $n _h, $width, $height);
Image output new picture, Save as
imagejpeg ($new, "q1.jpg");
Imagedestroy ($new);
Imagedestroy ($img);
? >
After using the browser to run, there will be a q1.jpg in the index.php of the same level, the picture is proportional scaling, the path can be changed in the source code, put in their own projects to go or write a method is also OK
The above is the entire content of this article, I hope to learn the PHP language can help.