Posted: Tue Nov 01, 2005 6:19 pm Post subject:
Dynamic sig images with PHP
I'm sure by now most of you have noticed, and probably voted in, the 'poll' I have in my sig. Some of you also asked me "How did you do that?". Well, here's a tutorial of how I did that, and how you can create your own dynamic sig imagery with PHP.
Requirements:
A webhost that supports PHP with GD. I am using my friend Saberhawk's server There are plenty of free web hosts that allow you to use GD, although not all of them use the 5th version of PHP, which I optimized my own sig code for.
Note: This is NOT a tutorial on how to code in PHP or anything else. It only shows you how to use dynamic content in images.
To use dynamic images, you (obviously) have to use the address of the image inbetween the [img ][ /img] tags. But, normal (.png, .jpg, .gif, etc) images can't have dynamic content. What to do? Simple trick, you create a directory on your host, name it, for example, sig.png, and drop the script which generates the dynamic content (called index.php) into that directory. I won't explain how that works, just know that by simply calling that sig.png in your browser, that index.php will be executed and you will get your dynamic image.
It is up to you what dynamic content you want to put in your imagery, if you know PHP well enough. I, for example, used it to tally the poll's results. I am attaching the script I use, so you can modify it to suit your needs. The script is commented, but I'm sure some fo you will need more explanations. Just ask here and I'll explain.
Full example:
I coded up the script to dynamically generate the image as well as tally the votes.
I logged into my host's server, created the directory sig.png, and added files index.php and counter.txt (it stores the poll votes) into it.
I added this BBCode to my sig to use it. Voila.
Any questions?
sig.rar
Description:
The script I used. Fairly well commented, so you can customize it easily.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum