Home arrow PHP arrow Page 4 - Enhancing Dynamic Twitter Signature Images with PHP

Implementing the class - PHP

In my last article we began putting together a solution that will allow us to display dynamic Twitter signature images in forum posts and emails. In this article weíll continue where we left off by adding the functions that will harness the power of GD to create the actual image.

  1. Enhancing Dynamic Twitter Signature Images with PHP
  2. Rendering an image
  3. Embedding the pieces
  4. Implementing the class
By: Nilpo
Rating: starstarstarstarstar / 4
August 13, 2009

print this article



Now that weíve built a class that will produce a Twitter signature image, itís time to put that class to use.  The easiest way is to add the relevant code to instantiate this class right into the same PHP file so that the file can be loaded all in one go.

isset($_GET['name']) or die('You must provide a user name.');


new SignatureImage($_GET['name'], 'banners/my_banner.jpg', 'avatars', 'cache');

Adding the above code anywhere outside of the class will do.  Save the PHP file with a name such as SignatureImage.php and youíre ready to go.  Any time you want to display your signature image, you simply need to add an HTML image reference using the URL to your PHP file.  For example, the URL to display my signature image would look something like this:


Donít forget to add the Twitter screen name to the URL so that the PHP script knows what user to get stats for.  Since the script returns an actual JPEG image, you can add this quite easily using HTMLís IMG tag or VBCode forum tags.

<img src=" http://www.somesite.com/SignatureImage.php?name=WindowsGuru">


[IMG] http://www.somesite.com/SignatureImage.php?name=WindowsGuru[/IMG]

While we have a fully operational PHP script at this point, letís not stop there.  Tune in for the third and final installment in this series and Iíll show you how to implement proper object-oriented PHP error handling into this script.  Iíll also show you a quick and effective method of maintaining usage statistics to see how many times your signature image is displayed.  Until next time, keep coding!

>>> More PHP Articles          >>> More By Nilpo

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: