Categories Site Actions X

Making an IP forum signature with PHP

Posted on Monday, July 12th, 2010 in Internet, Other by Nick

Ever seen one of those cool forum signatures that display your IP address? Ever want to make one? Well, in this tutorial we’ll cover how to make one.

First off, lets set up our header and image size.

Now we can call up our colors. In this case I'm using white and black

//Our colors (the image uses white)
$black = imagecolorallocate($image, 255, 255, 255);
$white = imagecolorallocate($image, 0, 0, 0);

Notice how it uses RGB instead of Hex color codes.
The way the PHP GD library works, we need to specify a font. Unlike in CSS though, we actually have to have the font uploaded on the host. So I downloaded a font from DaFont.com and uploaded it the main directory.

$font = 'digital-7';

Now we can write text to the image.

//Putting the text on the image
imagettftext($image, 15, 0, 4, 18, $white, $font, 'Your IP:');
imagettftext($image, 15, 0, 75, 18, $white, $font, $_SERVER['REMOTE_ADDR']);

To finish it off

//Finishing up
imagepng($image);
//Cleaning up
imagedestroy($image);
?>

The finished product looks like this:
ipsig
The final code looks like this:

HomeForumsMaking an IP forum signature with PHP

This topic contains 0 replies, has 1 voice, and was last updated by  Nick July 12, 2010 at 9:38 PM.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3209

    Nick
    Keymaster
    • Offline

    Ever seen one of those cool forum signatures that display your IP address? Ever want to make one? Well, in this tutorial we’ll cover how to make one.
    [See the full post at: Making an IP forum signature with PHP]

    Please let me know about any site issues!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Join the forum to add your own thoughts!