img4me just released an API to their text to image service. This basically allows you to send any peice of text through a URL and have it convert it into an image. Now you wouldn’t want to convert a whole paragraph, but this does work especially nice for email addresses or other information you don’t want to be crawled by the search bots.
Here is a quick function that allows you to easily add this to any project.
function img4me($text,$font,$fcolor,$size,$bcolor,$type)
{
/*
Parameters
text* = text to be converted. (required)
font = arial, comic, georgia, impact, lucida, simsun, tahoma, times, trebuchet, verdana (default: courier)
size = font size in number 5-35 (default: 12)
fcolor = font color in HEX (default: 000000)
bcolor = background color in HEX - leave empty for transparent background
type = gif, jpg, png (default: png)
*/
if(!empty($text))
{
$optional = array('font','fcolor','size','bgcolor','type');
foreach($optional as $key => $value){
if(!empty($$value)){$get_prams .= '&'.$value.'='.$$value;}
}
$url = 'http://api.img4me.com/?text='.urlencode($text).$get_prams;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$return_data = curl_exec($ch);
return '
';
}
else{return 'error: text was empty';}
}
Similar Posts:
- jQuery Image Gallery with Transitions and Navigation
- jQuery AJAX Loading – Display Images or Text Until Script is Finished (Part 2)
- Rotate Images with jQuery and PHP
- UPDATED: Strip Off Characters from String Using PHP (substr)
- Display Last.fm’s Recent Tracks on Web Site with PHP Function


No comments yet.