A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[PHP] Uber cool signatures or just pictures!

1k views · started by blackjew ·
#1
[PHP] Uber cool signatures or just pictures!
Hi guys, I am Jakob more commonly known as azmazm. I like coding with new languages as I do with this one (my favorite) PHP!


Now what we are going to be doing is making a simple image using php that will either display, The ip, OS, Or web browser!

Now lets begin.
<?php
$img_number = imagecreate(350,100);
$backcolor = imagecolorallocate($img_number,61,61,61);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);
$number = " Your IP is $_SERVER[REMOTE_ADDR]";
Imagestring($img_number,2,5,50,$number,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>


Now We will look at this line for a start
$img_number = imagecreate(350,100);

Basically what this is going to do is assign the variable $img_number to the command imagecreate. What does imagecreate do? You got it, creates the image! :3 The numbers are the length and width So edit to your liking but 350 x 100 is good for signatures.

Now this
$backcolor = imagecolorallocate($img_number,61,61,61);

Ok so what this does is sets the variable for the backround color (note the colors are in rgb) (61,61,61) This is going to display a nice grey, but if you want here is the link to an rgb color code generator.

ColorSchemer - Online Color Scheme Generator

Rgb is in this order, Red ammount Green ammount, Blue ammount.

And this line :3
$textcolor = imagecolorallocate($img_number,255,255,255);[/php
same just for the text color (White text)

This is the line that will put it all together.
[php]imagefill($img_number,0,0,$backcolor);[/php]
It adds the backround color we set the img width and height we set everything to make the image.

Next line
[php]$number = " Your IP is $_SERVER[REMOTE_ADDR]";[/php]
Heres the fun :D "Your IP is $_SERVER[REMOTE_ADDR]"

Now edit the text to your liking [b]MAKING SURE TO LEAVE $_SERVER[REMOTE_ADDR] AS IT IS WHAT GRABS THERE IP.[/b]


Next line
[php]Imagestring($img_number,2,5,50,$number,$textcolor);[/php]
This is where the $number variable gets its location and text size
2,5,50 is the thing we will edit 2 is the text size 5 is the position from the left 50 is the position from the top

and the next line :)
[php]header("Content-type: image/jpeg");[/php]

Basically what this line is doing
Logical says hello what image do you want to show
You send a .php file
It is like LOLNO GTFO
but this line Makes it take a chill pill and be like k wer guud go in
Then you just party hard


next
[php]imagejpeg($img_number)[/php]
Is making it a jpg image you can also make png images pm if needed.

So now if you have done it correctly this is what it will look like.
[img]http://azmazm.com/php/moo.php[/img]

PHP SIGNATURE WOOT


for those looking to tell the operating system of a user replace or add a variable to the line were $_SERVER[REMOTE_ADDR] or w.e the variable is PHP_OS

My host actually reads its own operating system (lul) so I cant show you it. :<
#2
I'm more for an artsyfartsy kind of signature, but this is really cool, I've seen sigs like this before, but I've never really tried to make one.
Never knew that it was actually this simple.
Thanks for the share <3
#3
Eli wrote:
I'm more for an artsyfartsy kind of signature, but this is really cool, I've seen sigs like this before, but I've never really tried to make one.
Never knew that it was actually this simple.
Thanks for the share <3


There is also a way, Say if you wanted your current signature to say darth vader knows where you live, You could use this to display the image from another jpeg then use the variables. I am VERY tired and that sounds decent to me so let me re read it and if not I will just upload a picture showing you.