![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Dynamic Pictures?
How do you program a targeted picture on your server to be dynamic to some specified data?
I'm thinking I could do it with Python by automatically reuploading a newly saved picture every 10 minutes, and keep it running in the background. But I know there's an easier way. I'm talking about those pictures that can keep track of your stats on a certain website, or tell the viewer their IP address. |
|
|
|
|
|
#2 |
|
Expert Programmer
|
That would be PHP.
It can create images, so it uses a function to get an IP and them it turns it into an image. Cool huh? You could use Python, but your server would need Python and something liek PyGame or PIL installed.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
But how does the image target run a php script?
And I could still use Python much more easily the way I mentioned. |
|
|
|
|
|
#4 |
|
Expert Programmer
|
usually its not a direct link to an image, but a link to a php script. IIRC.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Yayzor!
I made a dynamic image in Python for my website. It creates a temporary image with pygame, and that is the return value for the function. If you visit the website with Mozilla you'll see that it's not an actual image, but interpreted as one if you use the img tags. http://jammersbase.ath.cx/forumimage?userID=1 |
|
|
|
|
|
#6 | |
|
Programmer
Join Date: Dec 2005
Posts: 65
Rep Power: 3
![]() |
Quote:
http://doommod.sourceforge.net/michael.png First make the PHP script, start out by explicitly defining the output header: <?php
header("Content-type: image/png");Once your script is complete (ie, you can go to http://www.blah.com/yourscript.php and have it output the image), you can use Apache's modRewrite to modify incoming HTTP requests to reroute yourscript.png to yourscript.php internally. It will appear to others as if it's a valid static image file, but of course it's not ![]() |
|
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4
![]() |
PHP's support for dynamically creating images is excellent. If you're working in a CGI script in a language that isn't quite so great at this, see if your host has ImageMagick; you can shell out to it for image operations and it rules.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|