PHP Classes

PHP Image Filter GD: Apply image effect filters to remote images

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   View files Documentation   Demos   Screenshots Screenshots   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-06-15 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 214 All time: 7,482 This week: 1,027Up
Version License PHP version Categories  
image-filter 1.0.1Custom (specified...5.4PHP 5, Graphics
Description Author  

This class can apply image effect filters to remote images.

It can take the path of an image and retrieve it to create a true color GD image resource.

The class can apply several image filtering effects and save the result back to a PNG file or serve it as the output of the current script.

Currently it can apply the following image filtering effects:

- Brighten to lighten a darker image
- Brush to adds a slight dabbed, brushed effect
- Darken an overly bright image
- Edge detect to highlights borders between colors on an image, similar to emboss
- Emboss to adds a stamped metal effect
- Flip an image vertically
- Gray scale to convert color image to black and white
- Larger to increase the image dimensions by 2 times
- Mirror to produces a mirrored reflection
- Negative to produces a photo negative
- Pixelate an image
- Sephia to add an aged photo effect
- Sharpen a blurred image
- Sketch to add a sketched, comic book effect
- Smaller to reduce the image dimensions by 2 times
- Smooth to slightly blur an overly sharpened image

Picture of Mike Jordan
  Performance   Level  
Name: Mike Jordan <contact>
Classes: 5 packages by
Country: United States United States
Age: 53
All time rank: 1673222 in United States United States
Week rank: 618 Up63 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

App:       PHP Image Filter GD
Version:   1.0.1
Author:    MT Jordan <>
Copyright: 2014
License:   zlib/libpng License


Image Image Filter GD: Image class to apply effects filters to remote images


Image Filter GD is PHP class that can apply image effects filters to remotely linked images. The class can be used with CMS's, blogs or other forum applications as a base for BBCode style tags or it can be applied using Javascript. 

brighten: Lightens a darker image.
brush: Adds a slight dabbed, brushed effect to an image.
darken: Darkens an overly bright image.
edgedetect: Highlights borders between colors on an image. Similar to emboss.
emboss: Adds a stamped metal effect to an image.
flip: Flips an image vertically.
grayscale: Converts color image to black & white.
larger: Increase an image dimension by 2x.
mirror: Produces a mirrored reflection of an image.
negative: Produces a photo negative of an image.
pixelate: Pixilates an image.
sephia: Adds an aged photo effect to an image.
sharpen: Sharpens an blurred image.
sketch: Adds a sketched, comic book effect to an image.
smaller: Reduces an image dimension size by half.
smooth: Slightly blurs an overly sharpened image.


Image Filter GD Features:

    * Effects filters are non destructive to original image.

Image Filter GD Restrictions:

    * Only supports GIF, PNG and JPG/JPEG images.
    * Only the first frame of animated GIFs are processed.
Image Filter GD Requirements:

    * PHP 5.4+
    * Enabled GD extension
    * Enabled fopen wrappers or cURL extension



1. Upload image_filter.php and error.png to a readable directory. 
2. Download the PHP Image cURL dependency package image_info.php if using the cURL extension and upload to the same directory as step 1.

For a standalone img tag


<img src="" alt="" />

For a Smarty Plugin

Download function.img_filter.php and upload to the plugins directory of your Smarty installation.
Edit the $img_filter_URL variable to the absolute path to image_filter.php.

Add the following to your template.

{img_filter src='' filter='smaller'}

For a BBCode style tag



Use the following as the Regular Expression 


Use the following as the Replacement.

<img src="$2&filter_gd=$1" alt="$2" />

Using the image_filter.js file and the class name filter and the alt attribute as the effect filter

Note: See filter.html for working example

Download the image_filter.js file and upload to a readable directory. Open image_filter.js and edit the url variable

Add the following script include to the footer of your page or template:

<script type="text/javascript" src=""></script>


<img src="" class="filter_gd" alt="sharpen" /> 

  PHP Image Filter GD DemoExternal page  
  • demo.jpg
  Files folder image Files  
File Role Description
Accessible without login Image file error.png Output Displayed image on error
Accessible without login HTML file filter.html Doc. Example HTML file
Accessible without login Plain text file function.img_filter.php Aux. Smarty Plugin Function
Accessible without login Plain text file image_filter.js Data Demo Javascript file that handles DOM functions
Plain text file image_filter.php Class Class file that handles the image effects
Accessible without login Plain text file license.txt Lic. zlib/libpng License
Accessible without login Plain text file readme.txt Doc. Installation and Description 154KB
Downloadimage-filter-2014-06-15.tar.gz 154KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Image cURL Download .zip .tar.gz Required for cURL functions if fopen wrappers are disabled Conditional
 Version Control Unique User Downloads Download Rankings  
 0%Total:214All time:7,482
 This week:0This week:1,027Up