Create GeoIP Badge Using PHP Image Processing And GD
When making the badges I always use javascript. This tutorial shows you how to use the GD library to dynamically create simple badges on your site.
Basically, image generation is done in three steps:
- allocating an image
- drawing into the allocated space
- releasing the allocated data in picture format to the browser
[cfields]badgegd[/cfields]
As usual, obtaining client Ip Address simply by calling this php predefined variable, this time we will also trying to support for IPv6. One drawback, i still don’t know how to resize canvas to be fit with text if overflown, dynamically. Ie: the long IPv6 address.
<?php echo $_SERVER["REMOTE_ADDR"]; ?>