Forum Moderators: coopster
I'm looking for something where I can easly include a PHP file and pass the text which will be returned as a graphic.
I know this excludes people with screen readers and I know there are spambots supposedly able to OCR these, but for this particular application/customer is the best option.
Is anyone using something like this?
<?php
header("Content-type: image/png");
$email = $_GET['email'];
$im = imagecreatefrompng("email.png");
$black = imagecolorallocate($im, 0, 0, 0);
$px = (imagesx($im) - 7.5 * strlen($email)) / 2;
imagestring($im, 3, $px, 9, $email, $black);
imagepng($im);
imagedestroy($im);
?>
Just create a blank 200 X 30 email.png it would be called from [yoursite...]
or if you want your own custom font change
imagestring($im, 3, $px, 9, $email, $black);
to
$font = 'verdref.ttf';
imagettftext($im, 10, 0, 20, 15, $black, $font, $email);
You will obviously need to upload verdref.ttf to your server.
Playaround with the numbers to align and change font size and 0, 0, 0 in $black for colour.
<?php
header("Content-type: image/png");
$name= $_GET['name'];
$where= $_GET['where'];
$extension= $_GET['extension'];
$email = $name . "@" . $where . "." . $extension;
$im = imagecreatefrompng("email.png");
$black = imagecolorallocate($im, 0, 0, 0);
$px = (imagesx($im) - 7.5 * strlen($email)) / 2;
$font = 'verdref.ttf';
imagettftext($im, 10, 0, 20, 15, $black, $font, $email);
imagepng($im);
imagedestroy($im);
?>
print '<img src=/email.php?name=name&where=domainname&extension=com>';
The ideal setup would be to call a simple include, pass the text via PHP and get the image returned. I guess actually creating those images only once would be good too.
If I was a programmer I guess I could do it, but I only know enough to more or less understand what a script is doing.
Thanks for the help!