Here is a simple script to resize the given image. This requires PHP5, GD library.
First download the file and include to your code.
Usage example:
1
2
3
4
5
6
7
8
9
10
11
12
| <?php
// *** Include the class
include("resize-class.php");
// *** 1) Initialise / load image
$resizeObj = new resize('sample.jpg');
// *** 2) Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(200, 200, 'crop');
// *** 3) Save image
$resizeObj -> saveImage('sample-resized.jpg', 100);
?> |
<?php
// *** Include the class
include("resize-class.php");
// *** 1) Initialise / load image
$resizeObj = new resize('sample.jpg');
// *** 2) Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(200, 200, 'crop');
// *** 3) Save image
$resizeObj -> saveImage('sample-resized.jpg', 100);
?>
Editorial Team
We are a group of young techies trying to provide the best study material for all Electronic and Computer science students. We are publishing Microcontroller projects, Basic Electronics, Digital Electronics, Computer projects and also c/c++, java programs.