Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 
Webmaster Blog

8 Cool Functions in the GD2 extension

Most PHP developers have at least heard of GD2; thanks to its prolific use in CAPTCHA generation, the image functions in PHP are standard practice for many. But the extension’s uses don’t end there. After the fold, here are eight cool things you probably weren’t aware could be done with GD2, and might be useful for your web applications.

(Note that a few of these may not be available depending on your PHP/GD setup, check the manual)

  1. Get the size of an icon file, with getimagesize() (also works on all standard image formats)
  2. Apply a gaussian-blur to an image, with imagefilter()
  3. Rotate an image, with imagerotate()
  4. Flood-fill an area of an image, with imagefill()
  5. Grayscale an image, also with imagefilter()
  6. Draw polygons and arcs — maybe for mathematical diagram? — with imagepolygon() and imagearc()
  7. Copy and resize a section of an image, with imagecopyresized()
  8. “Sketchify” images for a pencil-illustration-style effect, also with imagefilter() (see a pattern here?)

The phpied blog has some cool demos of the imagefilter() function in particular.

Tags: , ,


Related Posts
» Creating facebook like popup dialog in your web app
» Say hello to namespace naming conventions!
» WebGrind: web-based frontend for XDebug PHP profiling
» PEAR Text_Diff is now stable!
» Zend Framework: The Best Framework for Use With Other Frameworks
 



Leave a Reply

Advertise with Us!


Blog Categories Blog Archives


Tutorials Scripts Web Hosting Developer Manuals
Resources