Log in

View Full Version : PHP image output


Trashed20
05-02-2003, 18:53
I've seen a couple of people's signatures with random pictures appearing due to the magic of php. I've done some searching but can't find a mechanism that will output it in the way you guys are doing. Anyone feel like putting up some code for the picture thing or at least explainging whats going on? Also, do you need the GD lib to do it?

Jeremy_Mc
05-02-2003, 19:06
i can give you some sample code if you PM me...

and to answer your question, yes you have to have GD unless you don't want the images to be made at runtime.

*jeremy

AJ Quick
05-02-2003, 19:10
Its simple..

Even simpler, if you use a bunch of pre-made images, that are rotated at random.

Jack
05-02-2003, 22:06
a little confused. :)

Does the img tag let you goto a *.php located on your server? - Since i know brandon ain't going to let us have php in our sig. :p

Jeremy_Mc
05-02-2003, 22:09
Originally posted by Jack
a little confused. :)

Does the img tag let you goto a *.php located on your server? - Since i know brandon ain't going to let us have php in our sig. :p

yes. :) check out this script:
http://pscode.com/vb/scripts/ShowCode.asp?txtCodeId=209&lngWId=8

Have fun with it and if you neep help, PM me

*jeremy

Trashed20
05-02-2003, 22:09
yes, his img tag is like < img src="mywierdpicturesigthing.php" > and it outputs a random picture. You would need the script on your own server to parse it. I just don't know how it works!

evulish
05-02-2003, 22:43
If I had to take a whack at this, I'd just send the HTTP headers back to make it looks like it's a JPG rather than a txt/html file. Then you have the code randomly select an image in a directory, open it, then send all the binary from the image to the client. (Or use GD to make your own, I guess.,..unless you want to be REALLY cool and put JPEG compression and stuff in your program :D)

Brandon Martus
05-02-2003, 23:06
My signature uses the GD Libraries.

$im = imagecreatefromjpeg ('/path/to/my/blank/file.jpg');
$black = imagecolorallocate ($im, 0, 0, 0);
imagettftext ($im, 12, 0, 17, 28, $black, "/path/to/my/font/tahoma.ttf", "This is what you see on the image");

header ("Content-type: image/jpeg");
imagejpeg ($im);
exit;

This is a stripped down version of the code that powers my signature.

Last weekend I created a neat little image generator with the GD libraries. I'll post something about it when the whole project (http://www.listen-to.com/) is complete. Some of you may remember the early days of the project. :)

Joe Matt
06-02-2003, 09:50
As for my sig, this is a neat thing I got off of a site. I'm going to get the php and then edit the picture and post it on my server.

BTW, I KNOW where you live....

Brandon Martus
06-02-2003, 09:58
Originally posted by JosephM
BTW, I KNOW where you live....

Louisville, Colorado?.... I dont think so..

Joe Matt
06-02-2003, 10:35
Originally posted by Brandon Martus
Louisville, Colorado?.... I dont think so..

Errr... Well I SORTA know the GENERAL AREA you LIVE!!!

:p

It says that at home I'm in Massachusetts.

And I looked at the early project, SWEET!!! :yikes:

LONG LIVE LISTEN TO!!!

Gadget470
06-02-2003, 11:05
When I'm at school your signature says i'm 40 minutes (by car) away from where I really am, at home I'm in another state (IL) which is about 4 1/2 hours away.

The basic context of your script is a tracert matched with locations. It comes down to where the main router is for whatever service you use is at. Or the closest readable router. (Some networks hide their IP addresses from ping/tracert)

Brandon Martus
06-02-2003, 12:45
Originally posted by JosephM
Errr... Well I SORTA know the GENERAL AREA you LIVE!!!

Well... You did get the country right, I suppose. Last time I checked, Colorado & Michigan were 2 timezones apart.

Trashed20
06-02-2003, 14:45
hrm, listen-to images for use in any application..... very interesting indeed :) i'd use it

Brandon Martus
06-02-2003, 14:47
VERY dynamic.

I cant wait. :)


Plus lots of music listening tracking & stats.