text-image position
Posted: Fri Nov 12, 2010 7:07 pm
Hi all
I'm new. Sorry for my bad english!
I've created a php code to convert text taken data after form submit and coverted in jpg image.
But i have a little problem.
The phrases of text-image when they are shown on a background, change their position if the user has insterted in the form a little words or big words.
In fact the phrases become small or large and so the text changes position.
I need php script to control the text-image position independently to the word's user in the form and to estimate its position.
Help me!
This is the code:
I've created a php code to convert text taken data after form submit and coverted in jpg image.
But i have a little problem.
The phrases of text-image when they are shown on a background, change their position if the user has insterted in the form a little words or big words.
In fact the phrases become small or large and so the text changes position.
I need php script to control the text-image position independently to the word's user in the form and to estimate its position.
Help me!
This is the code:
Code: Select all
<?
$nome=$_POST["nome"];
$grado=$_POST["grado"];
$officiante=$_POST["officiante"];
$diobat=$_POST["diobat"];
$arcibat=$_POST["arcibat"];
$databat=$_POST["databat"];
$riga1="Il nuovo fedele dell'Altissimo chiamato";
$riga2= $nome;
$riga3= "ha ricevuto il sacramento del battesimo,";
$riga4= "dal $grado $officiante";
$riga5= "nella diocesi di $diobat,";
$riga6= "arcidiocesi di $arcibat,";
$riga7= "in data $databat.";
// Intestazione per la creazione di un'immagine jpeg
header("Content-type: image/jpeg");
$immagine = imagecreatefromjpeg("1zgdi07.jpg");
// Creazione del colore del testo dell'immagine
$ctesto = imagecolorallocate($immagine, 0, 0, 0);
$font = 'CloisterBlack.ttf';
// parametri: nome immagine, dimensione font, inclinazione, posx, posy, colore testo, font, testo
imagettftext($immagine, 16, 0, 100, 360, $ctesto, $font, $riga1);
imagettftext($immagine, 16, 0, 230, 390, $ctesto, $font, $riga2);
imagettftext($immagine, 16, 0, 110, 420, $ctesto, $font, $riga3);
imagettftext($immagine, 16, 0, 150, 450, $ctesto, $font, $riga4);
imagettftext($immagine, 16, 0, 50, 480, $ctesto, $font, $riga5);
imagettftext($immagine, 16, 0, 280, 480, $ctesto, $font, $riga6);
imagettftext($immagine, 16, 0, 180, 510, $ctesto, $font, $riga7);
// Stampa a video dell'immagine
imagejpeg($immagine);
// Distruzione dell'oggetto image
imagedestroy($immagine);
?>