PHP Classes

Crop Canvas: A class to crop images in a variety of ways.

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (6)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 65%Total: 4,948 All time: 546 This week: 114Up
Version License Categories
crop-canvas 1.0Free for non-comm...Graphics
Description 

Author

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 have it automatically cropped based on a threshold value.

The original image can be loaded from the file system or from a string (for example, data returned from a database.)

It will also compensate so you can use GD versions 1.x or 2.x (though obviously 2.x will produce much better results!)

Picture of Andrew Collington
  Performance   Level  
Name: Andrew Collington <contact>
Classes: 16 packages by
Country: United Kingdom
Age: 49
All time rank: 563 in United Kingdom
Week rank: 314 Down12 in United Kingdom Down
Innovation award
Innovation award
Nominee: 3x

  Files folder image Files  
File Role Description
Plain text file class.cropcanvas.php Class The main class file.
Plain text file class.cropinterface.php Class A web-based interface to the crop canvas class.
Accessible without login Plain text file inc.cropimage.php Aux. Dynamically outputs a resized image.
Accessible without login Plain text file inc.cropinterface.php Aux. The client-side code for the cropping interface.
Accessible without login Plain text file inc.cropjavascript.php Aux. Initiates elements to be handled by javascript.
Accessible without login Plain text file test.cropcanvas.php Example Just to show a few ways the class can be used.
Accessible without login Plain text file test.cropinterface.php Example Demo of cropping interface
Accessible without login Plain text file wz_dragdrop.js Aux. The drag & drop javascript behind the cropping interface. This code is created by Walter Zorn (http://www.walterzorn.com/dragdrop/dragdrop_e.htm).

 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,948
This week:0
All time:546
This week:114Up
User Ratings User Comments (4)
 All time
Utility:96%StarStarStarStarStar
Consistency:90%StarStarStarStarStar
Documentation:-
Examples:82%StarStarStarStarStar
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:592
 
This script is one of the best scripts for image cropping fro...
13 years ago (Iftikhar Mirza)
70%StarStarStarStar
Really, really great.
14 years ago (pablo)
67%StarStarStarStar
Just what I wanted, saved me the Job, thanks!!
14 years ago (Piet Hermans)
70%StarStarStarStar
Very useful
15 years ago (Nguyen Duc Phu)
67%StarStarStarStar