quarta-feira, 8 de agosto de 2012

Gerar imagem com PHP

<?php
$text = 'Este é o texto!';
$img = imagecreate( 170, 50 );
$background = imagecolorallocate( $img, 0, 200, 155 );
$text_colour = imagecolorallocate( $img, 255, 255, 0 );
imagestring( $img, 4, 20, 15, $text,
$text_colour );
imagesetthickness ( $img, 5 );


header( "Content-type: image/png" );
imagepng( $img );


imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $img );
?>

Mostrar a imagem:
<img src="genImage.php" alt="Imagem PHP" width="170" height="50">


Sem comentários:

Enviar um comentário