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


Host By : Shwe Yaung Myanmar
 
HomeAdvertisingSearchLatest imagesRegisterLog inAdvertising Space

 

 Add a users IP address to an image

Go down 
AuthorMessage
Admin
Admin



Posts : 49
Join date : 2008-01-09

Add a users IP address to an image Empty
PostSubject: Add a users IP address to an image   Add a users IP address to an image EmptySun Apr 06, 2008 7:15 am

<?php
$ip = $_SERVER['REMOTE_ADDR']; #get the users IP address

$font = 'arial'; #load the font file (make sure arial.ttf is in the same directory)

$size = imagettfbbox(10,0,$font,$ip); #get the height and width of the IP address
$width = $size[2] + $size[0] + 3;
$height = abs($size[1]) + abs($size[7]);

$im = imagecreate($width, $height); #create an image the same height/width of the text
$bg = imagecolorallocate($im, 255, 255, 255); #image background color
$color = imagecolorallocate($im, 0, 0, 0); #color used for the text

imagettftext($im, 10, 0, 0, 10, $color, $font, $ip); #write the IP address to the image

header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
Back to top Go down
https://shweyaungmyanmar.board-directory.net
 
Add a users IP address to an image
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Technology :: Web Technology Zone :: PHP Script-
Jump to: