<?php
// Using of resize class
require_once('images.class.php');
$new_width = 100;
$new_height = 100;
// new instance of class
$img = new images('image.jpg');
//create image from form
//$img = new images($_FILES['image'], 'upload');
// create image from string
//$img = new images($string, 'string');
// resizing image (constrain proportions)
$img->resize($new_width, $new_height);
// resizing image (use strictly setted params)
//$img->resize($new_height, $new_height, 'strict');
//saving image
$img->save('image.jpg');
// if you want another type of image
//$img->save('image.png', 'png');
//$img->save('image.gif', 'gif');
// clearing the memory
$img->clear();
// check error output
$errors = $img->getErrors();
?>
|