<?php
 
/*
 
 *    --------------------------------------------------------------------------------------------------------------------------
 
 *    Program            : Image class, PHP Class Library
 
 *    Version            : 1.0.0
 
 *    Files            : image.inc.php, test.php
 
 *    Author            : Lasantha Samarakoon
 
 *    Date released    : Monday, November 2, 2009
 
 *    Email            : [email protected]
 
 *    Licence            : http://www.gnu.org/licenses/gpl.txt
 
 *    --------------------------------------------------------------------------------------------------------------------------
 
 *
 
 *    This program is a freeware, which falls under GNU Genral Public Licence.
 
 *    ---------------------------------------------------------------------------------------------------------------------------
 
 *    You can modify this program, without any permission from the author. But be kind enough to send the updated version to the
 
 *    author through the above mentioned Email address.
 
 *    ---------------------------------------------------------------------------------------------------------------------------
 
 *    Documentation:
 
 *            Please refer the test.php file for hints on the usage of this class library.
 
 *    ---------------------------------------------------------------------------------------------------------------------------
 
 *    ************************************* PROUD TO BE A SRI LANKAN...!!! ******************************************************
 
 */
 
 
/*
 
 ------------------------------------------------------------------------------------------------------------------------------
 
                                               ****** DOCUMENTATION ******
 
 ------------------------------------------------------------------------------------------------------------------------------
 
 
 Functions:
 
    
 
    object open(string filename)
 
        - full qualified filename required
 
    
 
    object save(string filename, [string type])
 
        - type is optional. default type is 'png'. type can be 'jpg', 'png' or 'gif'
 
        
 
    object resize(int width, int height)
 
        - resize an image
 
    
 
    object crop(int x, int y, int width, int height)
 
        - crop an image
 
    
 
    object convertGrayscale()    
 
        - convert image into grayscale
 
    
 
    object convertSepia()
 
        - convert image into sepia
 
    
 
    object render([string type])
 
        - type is optional. default type is 'png'. type can be either 'jpg', 'png' or 'gif'
 
        
 
        
 
    NOTE:
 
        To test the following script, copy an image to drive D: and rename it as 'test.jpg'
 
*/
 
 
require_once 'image.inc.php';
 
 
$im = new Image();
 
$im->open("d:\\test.jpg");
 
 
$im->save('d:\\1.png', 'png');
 
 
$im->resize(800, 600)->crop(200, 200, 150, 300)->render()->save('d:\\test_res_crop.jpg', 'jpg');
 
 
$im->convertGrayscale()->save('d:\\test_gray.jpg', 'jpg');
 
 
$im->convertSepia()->save('d:\\test_sepia.gif', 'gif');
 
?>
 
 |