Login   Register  
PHP Classes
elePHPant
Icontem

File: test.cropcanvas.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrew Collington  >  Crop Canvas  >  test.cropcanvas.php  >  Download  
File: test.cropcanvas.php
Role: Example script
Content type: text/plain
Description: Just to show a few ways the class can be used.
Class: Crop Canvas
A class to crop images in a variety of ways.
Author: By
Last change: Brought up-to-date for new class.
Date: 2006-06-27 06:39
Size: 830 bytes
 

Contents

Class file image Download
<?php

/**
 * $Id: test.cropcanvas.php 44 2006-06-26 10:05:41Z Andrew $
 * 
 * [Description]
 * 
 * Example file for class.cropcanvas.php.
 *
 * [Author]
 * 
 * Andrew Collington <php@amnuts.com> <http://php.amnuts.com/>
 */

require('class.cropcanvas.php');
$cc =& new CropCanvas();

if (
$cc->loadImage(dirname(__FILE__). '/original.png')) {
    
$cc->cropBySize('100''100'ccBOTTOMRIGHT);
    
$cc->saveImage(dirname(__FILE__). '/final1.jpg');
    
$cc->flushImages();
}

if (
$cc->loadImage(dirname(__FILE__). '/original2.png')) {
    
$cc->cropByPercent(1550ccCENTER);
    
$cc->saveImage(dirname(__FILE__). '/final2.jpg'90);
    
$cc->flushImages();
}

if (
$cc->loadImage(dirname(__FILE__). '/original3.png')) {
    
$cc->cropToDimensions(6737420255);
    
$cc->showImage('png');
}

?>