PHP image output

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?

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

Its simple…

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

a little confused. :slight_smile:

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. :stuck_out_tongue:

*Originally posted by Jack *
**a little confused. :slight_smile:

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. :stuck_out_tongue: **

yes. :slight_smile: 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

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!

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)

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 is complete. Some of you may remember the early days of the project. :slight_smile:

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…

*Originally posted by JosephM *
**BTW, I KNOW where you live… **

Louisville, Colorado?.. I dont think so…

*Originally posted by Brandon Martus *
**Louisville, Colorado?.. I dont think so… **

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

:stuck_out_tongue:

It says that at home I’m in Massachusetts.

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

LONG LIVE LISTEN TO!!!

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)

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

hrm, listen-to images for use in any application… very interesting indeed :slight_smile: i’d use it

VERY dynamic.

I cant wait. :slight_smile:

Plus lots of music listening tracking & stats.