Php scaling Image instance code
- Include ('simpleimage. php ');
- $ Image = new SimpleImage ();
- $ Image-> load('picture.jpg ');
- $ Image-> resize( 250,400 );
- $ Image-> save('picture2.jpg ');?>
-
2. set the width and proportional scaling
- Include ('simpleimage. php ');
- $ Image = new SimpleImage ();
- $ Image-> load('picture.jpg ');
- $ Image-> resizeToWidth (250 );
- $ Image-> save('picture2.jpg ');?>
-
3. set the height and 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 ');?>
-
4. scale to 50% in proportion
- Include ('simpleimage. php ');
- $ Image = new SimpleImage ();
- $ Image-> load('picture.jpg ');
- $ Image-> scale (50 );
- $ Image-> save('picture2.jpg ');?>
-
5. zoom in and out to the screen
- Header ('content-Type: image/jpeg ');
- Include ('simpleimage. php ');
- $ Image = new SimpleImage ();
- $ Image-> load('picture.jpg ');
- $ Image-> resizeToWidth (150 );
- $ Image-> output ();?>
Note: SimpleImage. php can be obtained from the download link provided at the beginning of this article. >>> Articles you may be interested in: examples of php and other proportional scaling images refer to SimpleImage, a tool such as php, to learn the code example of php batch scaling images |