Forum Moderators: phranque

Message Too Old, No Replies

How to create a dynamic image based on account status

didn't know where else to put this

         

ajs83

4:36 am on Mar 28, 2005 (gmt 0)

10+ Year Member



I am going to be offering a service to people and it's one I presume (and hope) many will want to post about on other sites as well as post in their signatures there, and would like to create one of those customized account images, but wouldn't know where to start.

One example that I've seen before is those with the "Currently listening to..." and liked the concept of it.

What are they called so I could look up info on them online or how would I go about creating something to that effect? Thanks!

dmorison

7:39 am on Mar 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One way to create a dynamic image is to use a scripting language that has an interface with a graphics library (such as PHP), and is able to generate images on the fly:

[php.net...]

Using PHP to do this, you then have access to everything a PHP script can do - for example making a query your database to get an account status - before generating the image.

With PHP+GD you can also load in a background image as a starting point, and then add your own text etc. over the top, which is probably the way to go.

To ensure maximum compatability with older browsers; if I were doing this I would set-up a rewrite using .htaccess so that dynamic images are served through a filename that looks like an image and not a script; for example you could map:

/account/1234/status.png > /imagescript.php?account=1234

Hope this helps!

ajs83

7:36 am on Apr 14, 2005 (gmt 0)

10+ Year Member



Finally got back to this task...

How would I get the item to work with a db? Especially if users decide to post it in their signatures elsewhere?

ajs83

11:32 pm on Apr 20, 2005 (gmt 0)

10+ Year Member



anyone?

jatar_k

11:34 pm on Apr 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



they link to a script on your server in an image tag anywhere

that script checks db and figures out their present status
that script creates an image with proper headers
and serves it back to them

dmorison laid it out pretty well

ajs83

3:13 am on Apr 21, 2005 (gmt 0)

10+ Year Member



Would the users link have to link to

[blah.com...]

while the file starts like

mysql_query("select * from blah WHERE account=1234")

?

That's the part the confuses me as I'm sure some would have issues handling the php file as an image.

ajs83

6:15 am on Apr 21, 2005 (gmt 0)

10+ Year Member



n/m