Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Tutorials Add a users IP address to an image
Chris
Posted on 28 Jun 2006, 23:06:15

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Code:
<?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);
?>


This is a simple script showing you how to create an image then write the IP address of the user viewing it to that image.
#2
Last edited by Chris at 2006-07-09 04:07:42 Reason:
Calamity
Posted on 28 Aug 2008, 17:09:21

Access: Member
Total Posts: 33
Joined: 2008-04-11

Hey how do you make the font size smaller, because if you used the same principle to make the security thingy you made, wouldn't it be the same size?

http://network-13.com/image

Cause that looks smaller. what would i do to the script to make it smaller.
#404
Calamity
Posted on 28 Aug 2008, 17:56:40

Access: Member
Total Posts: 33
Joined: 2008-04-11

Never mind, i figured it out =PPP, i was thinking to hard, and looking for something complicated, but it was simple.
#405
Network-13.com © 2013