Script and site usage:
All of the scripts on this site are provided free for non-commercial,
personal or non-profit use. If you wish to use any of these in a
commercial system, please refer to the payment
plan.

Support:
Support for each of the scripts is given, free of charge, on
the message board. Each
script has its own message board which can be accessed by clicking on the
'project forum' link (beneath the description of each project).

Proudly hosted with Dreamhost

Save $20 when signing up for Dreamhost by using the promo code amnuts20

If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh to encourage me to continue? Every little helps!

Crop Canvas

This class allows you to crop an image in a variety of ways. You can crop in an absolute or relative way (to a certain size or by a certain size), both as a pixel number or a percentage. Or you can automatically crop based on a threshold limit.

Along with this class comes a web-based interface that you can use the drag and easily resize the area you'd like to crop, set various initial cropping sizes (such as 16:9 porportion, or 200x100 pixels), and more.

cropcanvas.zip

A zip file containing all the required files for the crop canvas class and interface to give you a quick and easy download option.

class.cropcanvas.php

This is the main class file for the core cropping features.
If you use the crop interface then you will need this to process the image and for a number of variables/constants defined in this file.

<?php

/** * $Id: class.cropcanvas.php 44 2006-06-26 10:05:41Z Andrew $ * * [Description] * * This is a class allows you to crop an image in a variety of ways. * You can crop in an absolute or relative way (to a certain size or * by a certain size), both as a pixel number or a percentage. You * can also save or display the cropped image. The cropping can be * done in 9 different positions: top left, top, top right, left, * centre, right, bottom left, bottom, or bottom right. Or you can * crop automatically based on a threshold limit. The original * image can be loaded from the file system or from a string (for * example, data returned from a database.) * * [Author] * * Andrew Collington <php@amnuts.com> <http://php.amnuts.com/> * * [Feedback] * * There is message board at the following address: * * <http://php.amnuts.com/forums/> * * Please use that to post up any comments, questions, bug reports, etc. You * can also use the board to show off your use of the script. * * [Support] * * If you like this script, or any of my others, then please take a moment * to consider giving a donation. This will encourage me to make updates and * create new scripts which I would make available to you. If you would like * to donate anything, then there is a link from my website to PayPal. * * [Examples of use] * * require('class.cropcanvas.php'); * $cc =& new CropCanvas(); * * $cc->loadImage('original1.png'); * $cc->cropBySize(100, 100, ccBOTTOMRIGHT); * $cc->saveImage('final1.png'); * * $cc->flushImages(false); * * $cc->cropByPercent(15, 50, ccCENTER); * $cc->saveImage('final2.jpg', 90); * * $cc->flushImages(true); * * $cc->loadImage('original3.png'); * $cc->cropToDimensions(67, 37, 420, 255); * $cc->showImage('png'); */