News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPFreaks.com:
PHP Add Text To Image
January 26, 2009 @ 12:04:06

This new tutorial from the PHPFreaks.com website shows how to add text into a custom created image (they go with an Arial font in a PNG image).

One of the standard features of a message board is allowing members to have a signature, which is appended to the bottom of each post they make. Posters can put whatever they want into the signature (within forum settings). Putting quotes in one's signature is one of the more popular things to do. [...] Soon afterwards, I started receiving messages on a fairly regular basis asking me "What kind of sorcery is this?? How do I do that??" You know, I think it's kind of funny people should ask, because this is really nothing new.

His code (the full script is here) sets up the font size, the font face (Arial) and the quotes to be randomly pulled from first. The image manipulation comes next - making a PNG resource, adding a few colors and shapes, and dropping in the text.

Each line of the code is covered in detail so you'll understand exactly what's going on. The end result is a script that makes a simple image and can be easily expanded to work with other sources (like databases or flat text files).

5 comments voice your opinion now!
tutorial image dynamic gd text signature forum random


blog comments powered by Disqus

Similar Posts

WorkingSoftware.com.au: Configuring PHP4 and PHP5 to run concurrently on FreeBSD

Joey Rivera's Blog: Caching using PHP/Zend_Cache and MySQL

NETTUTS.com: Your First WordPress Plugin: Simple Optimization

DotVoid.com: Problem with downloading files with Internet Explorer over HTTPS

Stuart Herbert's Blog: Dealing With PEAR Dependency Quirks


Community Events





Don't see your event here?
Let us know!


release code framework list series api podcast conference laravel language introduction symfony interview zendserver community threedevsandamaybe deployment tips bugfix development

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework