El siguiente script convierte el texto recibido en una imagen. Útil, por ejemplo, para si deseamos ocultar las direcciones de correo de los bots de spam convirtiéndolas en imagen:
<?php
if(!isset($_GET['txt']))
{
exit();
}
header ("Content-type: image/png");
$string = $_GET['txt'];
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, 0, 0, $string, $text_color);
imagepng ($im);
?>
Este script lo guardamos como "txt2img.php" y su uso sería tan sencillo como poner algo similar a lo siguiente:
<img src="txt2img.php?text=webintenta" border="0">
donde el valor de la variable text será convertido en imagen.







