PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Info   View files Documentation   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 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 247 This week: 3All time: 7,422 This week: 377Up
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
Innovation award
Innovation award
Nominee: 1x

Details
App:       PHP Image Filter GD
Version:   1.0.1
Author:    MT Jordan <mtjo62@gmail.com>
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

*********************************************************************************

Installation:

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

Usage: 

<img src="http://mysite.com/path/to/image_filter.php?filename_gd=http://mysite.com/path/to/image.png&filter_gd=sharpen" 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='http://mysite.com/path/to/image.png' filter='smaller'}

*********************************************************************************
For a BBCode style tag

Usage: 

[img_filter=sharpen]http://mysite.com/path/to/image.png[/img_filter]

Use the following as the Regular Expression 

\[img_filter=(.*?)\](.*?)\[/img_filter\]

Use the following as the Replacement.

<img src="http://mysite.com/path/to/image_filter.php?filename_gd=$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
to: http://mysite.com/path/to/image_filter.php

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

<script type="text/javascript" src="http://mysite.com/path/to/image_filter.js"></script>

Usage:

<img src="http://mysite.com/path/to/image.png" class="filter_gd" alt="sharpen" /> 

Screenshots  
  • 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

Downloadimage-filter-2014-06-15.zip 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:247
This week:3
All time:7,422
This week:377Up