Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-22-2012, 06:32 AM   PM User | #1
markman641
Regular Coder

 
Join Date: Jul 2011
Posts: 246
Thanks: 58
Thanked 1 Time in 1 Post
markman641 has a little shameless behaviour in the past
PHP image questions

Alright so I googled up how to make a PHP image is this is what I got:



Now here is the REAL question. How would I go about making one that customizes to every user in my website?

Like I want to make a html code to give to my users like this:
Code:
<img src="http://fsprizes.com/images/signature/2_Money4Every1.gif" width="468" height="60" border="0" /></a>
So how would I do this?
markman641 is offline   Reply With Quote
Old 01-22-2012, 11:28 AM   PM User | #2
bacterozoid
Regular Coder

 
bacterozoid's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 486
Thanks: 23
Thanked 35 Times in 35 Posts
bacterozoid is an unknown quantity at this point
It looks like you've got the GD library figured out. It should be pretty easy to take this to the next step.

Your first option is to just generate images for every user once a day (or however often you want) and store them on your server, then give users images like:

http://fsprizes.com/images/signature/image-[enter user id here].gif

The better way would be to use a PHP page that generates a 100% up to date image every time, like this:

http://fsprizes.com/images/signature/image.php?user_id=[enter user id here]

In order to do that, you create the PHP page with all of your image generation code. Look at $_GET['user_id'] to figure out which user to generate the image for. Then use headers in PHP and a web browser will treat the PHP page just like an image.

Keep in mind that a lot of forums don't allow you to use images with a .php file extension. There are other ways around that, but it gets somewhat tricky.

See if that gets you started. You may have some questions about how to do one of the above options, so please ask if you do. I just wanted to give you the high level overview first.
bacterozoid is offline   Reply With Quote
Users who have thanked bacterozoid for this post:
markman641 (01-22-2012)
Old 01-22-2012, 06:04 PM   PM User | #3
markman641
Regular Coder

 
Join Date: Jul 2011
Posts: 246
Thanks: 58
Thanked 1 Time in 1 Post
markman641 has a little shameless behaviour in the past
Thanks! I didn't realize you could use GET for the image!

Now what were you saying about
Quote:
Keep in mind that a lot of forums don't allow you to use images with a .php file extension. There are other ways around that, but it gets somewhat tricky.
markman641 is offline   Reply With Quote
Old 01-22-2012, 06:11 PM   PM User | #4
bacterozoid
Regular Coder

 
bacterozoid's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 486
Thanks: 23
Thanked 35 Times in 35 Posts
bacterozoid is an unknown quantity at this point
It's easy to use a PHP file with the right headers to make a web browser treat it like an image. However, a lot of forum software will prevent images from loading if they have a .php or other non-standard extension.

I'm not too familiar with the process, so I can't give you any details on how to do it, but you can set up your web server to execute files with image extensions as PHP. I'm not sure what other problems that creates, so you may just need to do some googling or get some additional help on a forum.
bacterozoid is offline   Reply With Quote
Users who have thanked bacterozoid for this post:
markman641 (01-24-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:09 AM.


Advertisement
Log in to turn off these ads.