Php image scaling ,. PHP image proportional scaling, new file index.php, or Q.jpg under the statistics Directory (you can change the image name based on the source code) source code is as follows :? Php $ filenameq. php image proportional scaling,
The new file index.php contains a Q.jpg image in the statistics Directory (you can change the image name based on the source code)
The source code is as follows:
$ 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 and adjust part of the image
Imagecopyresized ($ new, $ img, 0, 0, 0, $ n_w, $ n_h, $ width, $ height );
// Output new image and save it
Imagejpeg ($ new, "q1.jpg ");
Imagedestroy ($ new );
Imagedestroy ($ img );
?>
After the browser is run, a q1.jpg image will be displayed in the directory at the same level of index.php. This image is an image scaled proportionally. you can change the path in the source code and put it in your project or write a method.
Example: the new file index.php has an image named Q.jpg in the statistics Directory (you can change the image name based on the source code). the source code is as follows :? Php $ filename = "q ....