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.
Now We will look at this line for a startPHP Code:
<?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);
?>
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! The numbers are the length and width So edit to your liking but 350 x 100 is good for signatures.PHP Code:
$img_number = imagecreate(350,100);
Now this
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.PHP Code:
$backcolor = imagecolorallocate($img_number,61,61,61);
ColorSchemer - Online Color Scheme Generator
Rgb is in this order, Red ammount Green ammount, Blue ammount.
And this line
[php]$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.
It adds the backround color we set the img width and height we set everything to make the image.PHP Code:
imagefill($img_number,0,0,$backcolor);
Next line
Heres the fun "Your IP is $_SERVER[REMOTE_ADDR]"PHP Code:
$number = " Your IP is $_SERVER[REMOTE_ADDR]";
Now edit the text to your liking MAKING SURE TO LEAVE $_SERVER[REMOTE_ADDR] AS IT IS WHAT GRABS THERE IP.
Next line
This is where the $number variable gets its location and text sizePHP Code:
Imagestring($img_number,2,5,50,$number,$textcolor);
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
Basically what this line is doingPHP Code:
header("Content-type: image/jpeg");
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
Is making it a jpg image you can also make png images pm if needed.PHP Code:
imagejpeg($img_number)
So now if you have done it correctly this is what it will look like.
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. :<
Results 1 to 3 of 3
- 28 Feb. 2011 06:42am #1
[PHP] Uber cool signatures or just pictures!
- 28 Feb. 2011 12:12pm #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
- 28 Feb. 2011 01:08pm #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.