PHP Classes

File: examples/example2.php

Recommend this page to a friend!
  Classes of Mohamed Elbahja   PHP Image Sizer   examples/example2.php   Download  
File: examples/example2.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Image Sizer
Resize images to a given width and height
Author: By
Last change:
Date: 8 years ago
Size: 725 bytes
 

Contents

Class file image Download
<?php

require('../image_sizer.php');

$img = new image_sizer();


/**
 * setImage(path)
 * path : path/to/image.png
 *
 */
$img->setImage('php.png');


/**
 * setSize
 * New image size
 * $img->setSize(Width, Height)
 */
$img->setSize(200, 200);

/**
 * show image
 *
 * $img->show(type, quality);
 * type : png, jpeg, jpg, gif
 * quality : image show quality 100 = 100%
 */
$img->show('jpeg', 100);



/**
 * saveTo
 * save image
 * $img->saveTo(full path and name, quality);
 */
//$img->saveTo('new_image.png', 100); // save image png type
//$img->saveTo('new_image.jpg', 100); // save image jpg type
//$img->saveTo('new_image.jpeg', 100); // save image jpg type
//$img->saveTo('new_image.gif'); // save image gif type