Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 4:22 pm
All times are UTC + 0
Dynamic sig images with PHP
Moderators: Global Moderators, Offtopic Moderators
Post new topic   Reply to topic Page 1 of 1 [2 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
John Galt
Commander


Joined: 01 Aug 2003
Location: Galt's Gulch

PostPosted: Tue Nov 01, 2005 6:19 pm    Post subject:  Dynamic sig images with PHP Reply with quote  Mark this post and the followings unread

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  Smile  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.

Download
 Filename:  sig.rar
 Filesize:  1.41 KB
 Downloaded:  441 Time(s)


Back to top
View user's profile Send private message Visit poster's website Skype Account
DoMiNaNt_HuNtEr
General


Joined: 16 Feb 2005
Location: North America Posts: You cannot comprehend...

PostPosted: Wed Nov 02, 2005 4:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Awsome! I'll definatly look in to this!

_________________
Destroy to create. All for the hunt to dominate!

IN-GAME NAME: MAKINTOKE

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
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


Powered by phpBB © phpBB Group

[ Time: 0.1581s ][ Queries: 13 (0.0105s) ][ Debug on ]