Home arrow PHP arrow Dynamic Twitter Signature Images with PHP

Dynamic Twitter Signature Images with PHP

Twitter is the latest and greatest craze in social networking sites. As such, many developers and businesses are using it as a marketing technique. Today weíre going to come up with a method for creating a dynamic signature image for forum posts and emails that will automatically load your Twitter feed and display your latest Twitter status. Weíll be using PHP to grab the content along with GD2 support to create the image.

TABLE OF CONTENTS:
  1. Dynamic Twitter Signature Images with PHP
  2. Building the class
  3. Parsing the XML feed
  4. Grabbing the avatar image
By: Nilpo
Rating: starstarstarstarstar / 3
August 11, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Iím going to be presenting the code in this article in an object-oriented fashion using PHP 5.  If youíre not already using object-oriented programming techniques itís important that you begin doing that.  You will be able to take advantage of more advanced features in PHP while building more robust applications.  In my opinion, itís one of the subtle differences between a true programmer and a simple scripter.

The first step in creating this project was determining what size to make the final image.  I considered the standard IAB ad unit sizes for banners, but they were either too big or too small for our purposes.  The 60 pixel height on a full banner (also called impact banner) was perfect, but a width of 480 pixels takes up a bit more real estate than I would like for a low profile signature image.  The half banner cuts that width in half, but then doesnít allow much room for both a userís avatar and text. 

So I decided to shy away from a standard ad unit and compromise between the two, settling on a width of 380 pixels and a height of 60 pixels.  With this size a userís avatar fits nicely inside the height and still allows about 300 pixels in width for the addition of text.  With the capacity to house four lines, this fits the Twitter statusí character length specification pretty nicely, as you can see in the live example below.

Once I decided on a unit size for the image, I needed to build a background image that was the proper size.  This is a simple background that will provide a nice- looking backdrop for the image as opposed to having it over a single background color.  You can use Gimp or any other image creation software to create your own, or download the one I created in Photoshop here.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- 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: