PHP Classes

PHP Image Class: Apply several types of image effects

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 505 All time: 5,792 This week: 54Up
Version License PHP version Categories
php-image-class 1.0GNU General Publi...5.2PHP 5, Graphics
Description 

Author

This class can apply several types of image effects.

It can process a queue of effects to apply to images.

Currently it can apply to an image effects like crop, rotate, add a watermark, resize, turn into black and white, apply filters, etc..

Picture of Daniel Kovács
Name: Daniel Kovács <contact>
Classes: 1 package by
Country: Hungary Hungary
Age: ???
All time rank: 326130 in Hungary Hungary
Week rank: 163 Up2 in Hungary Hungary Up

Details

Image class for basic image redesign. Author: Daniel Kovacs Email: kovacsdanielhun@gmail.com Webiste: kovacsdaniel.blogspot.com Version: 1.0 beta Release date: 2012.01.18 Thanks to: http://www.tuxradar.com/practicalphp/11/2/16 (special algorythms) http://php.about.com/od/gdlibrary/ss/grayscale_gd.htm (black and white algorythm) It's in beta version, so there can be bugs, if you find any, or you have some new ideas for functions I should implement, please write to kovacsdanielhun@gmail.com. Known Issues: - This class can only work with gifs and jpegs, and pngs - scatter bugs a little Installation: 1. Copy file to your website's folder 2. Include it 3. Set up settings $image = new Image; $settings = array(); $jobs = array(); /* Set up settings */ $settings['original_name'] = 'anyfolder/source.jpeg'; $settings['new_name'] = 'folder/dest.jpeg'; /* */ $settings['original_type'] = 'jpeg'; $settings['new_type'] = 'jpeg'; 4. Set up jobs /* You need to fill the 'jobs' $jobs with jobs like: */ $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "contrast"; $jobs[0]['contrast'] = 50; $jobs[1]['job'] = "duotone"; $jobs[1]['rplus'] = 10; $jobs[1]['gplus'] = 40; $jobs[1]['bplus'] = 80; $jobs[2]['job'] = 'resize'; $jobs[2]['width'] = 10; $jobs[2]['height'] = 0; $jobs[2]['percent'] = 0; $jobs[2]['scale'] = 0; /* You can have plenty of jobs, just have to increase $jobs[$i] ($i) */ /* You can see other usable filters and jobs under */ /* To start processing type these: */ $image->settings = $settings; $image->jobs = $jobs; $image->run(); 5. get image or render image ( when you render an image, after render it destroys the image in memory ) /* To get image you can use this: */ $image->image; /* or/and */ $image->render_image(); 6. get errors $image->errors(); /* array */ Available Jobs: $jobs[0]['job'] = 'crop' $jobs[0]['left'] = 120; (pixels from left) $jobs[0]['top'] = 120; (pixels from top) $jobs[0]['right'] = 120; (pixels from right) $jobs[0]['bottom'] = 120; (pixels from bottom) $jobs[0]['job'] = "rotate"; $jobs[0]['angle'] = 0; $jobs[0]['background'] = 0; $jobs[0]['transparent'] = 0; $jobs[0]['job'] = "watermark"; $jobs[0][0] = 0; $jobs[0][1] = 0; $jobs[0][2] = "watermark.png"; $jobs[0]['job'] = "resize"; $jobs[0]['width'] = 0; $jobs[0]['height'] = 0; $jobs[0]['percent'] = 0; Available Special Effects (Algorythms) $jobs[0]['job'] = "blackwhite"; $jobs[0]['job'] = "interlace"; $jobs[0]['job'] = "screen"; $jobs[0]['job'] = "duotone"; $jobs[0]['job'] = "noise"; $jobs[0]['job'] = "scatter"; $jobs[0]['job'] = "color_reduction"; Available Filters: $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "colorize"; $jobs[0]['r'] = 255; $jobs[0]['g'] = 0; $jobs[0]['b'] = 123; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "brightness"; $jobs[0]['brightness'] = 80; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "contrast"; $jobs[0]['contrast'] = 50; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "edgedetect"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "emboss"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "gaussian_blur"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "selective_blur"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "smooth"; $jobs[0]['smooth'] = -6; /-8 - 8/ $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "negate"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "mean_removal"; $jobs[0]['job'] = "filter"; $jobs[0]['filter'] = "grayscale"; Error codes: x0000: error: settings or jobs are not set x0001: error: image not found x0002: image is a null ->no image left /* too many crops */ x0003: error in arg list

  Files folder image Files (5)  
File Role Description
Plain text file image.php Class base class
Plain text file readme.txt Doc. readme
Image file test.JPEG Icon test image
Plain text file test.php Example test file
Image file example.png Output Example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:505
This week:0
All time:5,792
This week:54Up