Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1[PHP] Basic IP Image Generation Empty [PHP] Basic IP Image Generation Fri Feb 25, 2011 3:33 am

Nova

Nova
Member
Loading
My only request is that you use this to learn not just to leech source code off me and not obtain any knowledge.

Example:

[PHP] Basic IP Image Generation LOLExample

Requirements:

• A host with an image library such as GD or ImageMick (110mb.com is a site that has GD already configured.)

Code:

<?php
Header("Content-Type: image/png");

// Get the IP Address
$IP = $_SERVER['REMOTE_ADDR'];

// Set image width and height
$Width = 250;
$Height = 20;

// Create the image resource
$Image = ImageCreate($Width, $Height);

// Color Variables
$Black = ImageColorAllocate($Image, 0, 0, 0);
$Red = ImageColorAllocate($Image, 255, 0, 0);

// Make the image background black
ImageFill($Image, 0, 0, $Black);

// Add the IP string to the image
ImageString($Image, 3, 43, 3, "Your IP is: $IP", $Red);

// Output the created image in png format
ImagePng($Image);

// Free up resources
ImageDestroy($Image);

?>

2[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Fri Feb 25, 2011 3:59 am

MurdaH

MurdaH
Spoiler
Loading
Can you add an image as the background? instead of making it black?

3[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Fri Feb 25, 2011 11:53 pm

Nova

Nova
Member
Loading
MurdaH wrote:Can you add an image as the background? instead of making it black?

You can, as you see in my signature, it's a different method though.

4[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Sat Feb 26, 2011 5:57 pm

The Professor

The Professor
Contributor
Loading
Nova wrote:My only request is that you use this to learn not just to leech source code off me

Huh? I don't see what's there to "leech" from an image that displays a remote IP address. All in all, this is a pretty common PHP script.

Thanks anyways.
I might use this when I get into php soon.

5[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Sun Feb 27, 2011 4:35 am

Prince

Prince
Fresh Meat
Loading
omg he has my ip impossible

6[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Sun Feb 27, 2011 4:38 am

Prince

Prince
Fresh Meat
Loading
how can i use this in such a image like yours

7[PHP] Basic IP Image Generation Empty Re: [PHP] Basic IP Image Generation Sun Feb 27, 2011 5:31 am

RepBot1

RepBot1
Fresh Meat
Loading
Prince wrote:omg he has my ip impossible

omg he has ur IP hes gonna 1337 h4x you!!!11
No but seriously, welcome to the Internet.

Prince wrote:how can i use this in such a image like yours

MurdaH asked a similar question to this.
The topic name is "Basic IP Image Generation".
He won't be explaining how do so, in this thread at least.

Sponsored content


Loading

View previous topic View next topic Back to top  Message [Page 1 of 1]

Related topics

Permissions in this forum:
You cannot reply to topics in this forum