Recommend SimpleImage, a simple and practical resizing image tool, refer to http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/
How to use it :
Set width and height, scaling at unequal proportions
Copy code The code is as follows:
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image ->resize(250,400);
$image->save('picture2.jpg');?>
Set the width and scale proportionally
php
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth (250);
$image->save('picture2.jpg');?>
Set the height and scale proportionally
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToHeight(500);
$image->save('picture2.jpg');
$image->resizeToHeight(200);
$image->save('picture3.jpg');?>
Proportionally, scale to 50%
include('SimpleImage.php');
$image = new SimpleImage();
$ image->load('picture.jpg');
$image->scale(50);
$image->save('picture2.jpg');?>
Output directly to the screen after scaling
header('Content-Type: image/jpeg');
include('SimpleImage.php');
$ image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(150);
$image->output();? >
SimpleImage.php source code, please click on the link at the beginning of the article to download there
http://www.bkjia.com/PHPjc/327591.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327591.htmlTechArticle recommends a simple and practical zoom image tool SimpleImage, refer to http://www.white-hat-web-design .co.uk/blog/resizing-images-with-php/ Instructions for use: Set width and height, scale at unequal proportions...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn