PHP Classes

File: examples/example3.php

Recommend this page to a friend!
  Classes of Mohamed Elbahja   PHP Image Sizer   examples/example3.php   Download  
File: examples/example3.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: 598 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(100, 60);



/**
 * saveTo
 * save image
 * $img->saveTo(full path and name, quality);
 * return boolean
 */
var_dump($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