View Single Post
Old 04-27-2006, 09:06 PM  
BigBen
Confirmed User
 
Join Date: Nov 2004
Location: scv
Posts: 2,299
Pretty simple in php...

To get geo data to display for the text, they have a geo ip database that makes the 'text' argument a variable with the location of the surfer...
PHP Code:
$text getLocationFromGeoDatabase($_SERVER["REMOTE_ADDR"]);
ImageString(imagefontxy$textcolor); 
That's how it's done in its simplest form. There are other functions to use true type fonts which look much better. Pick up a copy of "Programming PHP" by O'Reilly. Great book if you're just starting out with PHP (or even if you're not starting out, it's still a good reference book).

Most people use the geo db's from www.maxmind.com. They offer a complete API to their database that makes it incredibly easy to use. This will overlay an image with a true type font using the maxmind db:

PHP Code:
include("geoip.inc");
header("Content-Type: image/jpeg");

$gi geoip_open("GeoIP.dat",GEOIP_STANDARD);
$location geoip_country_code_by_addr($gi$_SERVER['REMOTE_ADDR']);
geoip_close($gi);

$im ImageCreateFromJPEG("image.jpg");
Imagettftext($im1401010$textColor'verdana.ttf'$location);

ImageJPEG($im);
ImageDestroy($im); 
BigBen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook