Hey, I don't know if this is the right section, but there's no HTAccess section, so I'll just put it here. Anyways, I'd like to make one of those signatures that gets the IP of the person and then makes and image out of it with the IP. I think the only way to do this is with HTAcces, by making a new image with the persons IP. Is there anyway to do this? Thanks.

This will display user IP:

<?php echo $_SERVER['REMOTE_ADDR']; ?>

Then use GD library or imagemagick to create an image from that text, for example with imagemagick from command line it will be:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
exec("convert -pointsize 30 -label '$ip' image.gif");
?>

Anyway a section for .htaccess is in Hardware & Software » Linux & Unix » Linux Server & Apache. Bye :)

This will display user IP:

<?php echo $_SERVER['REMOTE_ADDR']; ?>

Then use GD library or imagemagick to create an image from that text, for example with imagemagick from command line it will be:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
exec("convert -pointsize 30 -label '$ip' image.gif");
?>

Anyway a section for .htaccess is in Hardware & Software » Linux & Unix » Linux Server & Apache. Bye :)

Thank you for both of your posts. This isn't done with PHP, though.

Here
is an image that shows you your IP. Is there any way to do it as a image?

The principle is the same of placing a watermark, just set coordinates and the text you want to place into an existing image. Here is an example, you can try it with the image attached:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$im = new Imagick('example.png');
$draw = new ImagickDraw();
$draw->setFontSize(18);
$draw->setFont('Arial');
$draw->setFillColor('#cc3300');
$im->annotateImage($draw, 25, 23, 0, $ip);

header( "Content-Type: image/{$im->getImageFormat()}" );
echo $im;
?>

Then you can:

1. save image and cache
2. or you can add to .htaccess file a directive so you can execute PNG as PHP and rename your test.php file to test.png, but this should be restricted to a directory:

<Directory /var/www/website/test/>
Options -Indexes
AddType application/x-httpd-php .png
</Directory>

so instead of: http://localhost/test/test.php
you can write: http://localhost/test/test.png

More info:
- http://php.net/manual/en/imagick.annotateimage.php
- http://php.net/manual/en/security.hiding.php
- http://httpd.apache.org/docs/2.0/mod/core.html#directory

bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.