Set the width and height, and scale proportionally; set the width and proportional scaling; set the height and proportional scaling; scale to 50% according to the scale; output directly to the screen after scaling, etc, the usage is as follows. If you are interested, you can
Set the width and height, and scale proportionally; set the width and proportional scaling; set the height and proportional scaling; scale to 50% according to the scale; output directly to the screen after scaling, etc, the usage is as follows. If you are interested, you can
We recommend a simple and practical image scaling tool SimpleImage. For more information, see
Usage:
Set the width and height, no record filing space, and scale proportionally
The Code is as follows:
Include ('simpleimage. php ');
$ Image = new SimpleImage ();
$ Image-> load('picture.jpg ');
$ Image-> resize( 250,400 );
$ Image-> save('picture2.jpg ');?>
Set width and proportional Scaling
Include ('simpleimage. php ');
$ Image = new SimpleImage ();
$ Image-> load('picture.jpg ');
$ Image-> resizeToWidth (250 );
$ Image-> save('picture2.jpg ');?>
Set height, proportional Scaling
Include ('simpleimage. php ');
$ Image = new SimpleImage ();
$ Image-> load('picture.jpg ');
$ Image-> resizeToHeight (500 );
$ Image-> save('picture2.jpg ');
$ Image-> resizeToHeight (200 );
$ Image-> save('picture3.jpg ');?>
Scale to 50% in proportion
Include ('simpleimage. php ');
$ Image = new SimpleImage ();
$ Image-> load('picture.jpg ');
$ Image-> scale (50 );
$ Image-> save('picture2.jpg ');?>
Scale and output directly to the screen
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 the link at the beginning of the article to download it, server space