Tom's Guide > Forum > Programmation > Insérer un texte dans une image
Mot :    Pseudo :           
 

Bonjour,
j'aimerai savoir comment faire pour insérer un texte sur une image comme ceci:
http://www.imagechef.com/ic/make.jsp?tid=Tree+Heart

j'ai trouvé sur pti ce script :
form.html

Code :
  1. Formulaire :
  2. <form method="get" action="image.php">
  3. <input name="texte" type="text">&nbsp;<input type="submit" value="Envoyer">
  4. </form>


image.php

Code :
  1. <?php
  2. if(isset($_GET["texte"])) $texte = $_GET["texte"]; else $texte = "yassine"; 
  3. header("Content-type: image/jpeg" ); 
  4. $background = imagecreatefromJPEG("foto.jpg" ); 
  5. $imageWidth = 800; // taille X 
  6. $imageHeight = 562; // taille Y 
  7. $im = imagecreatetruecolor($imageWidth,$imageHeight); 
  8. $bgcolor = imagecolorallocate($im,0,0,0); 
  9. imagecopy($im,$background,0,0,0,0,$imageWidth,$imageHeight); 
  10. imagedestroy($background); 
  11. $fontname="tahoma.ttf"; 
  12. $fontsize = "20"; 
  13. $angle = "1"; 
  14. $x = "400"; 
  15. imagettftext($im,$fontsize,$angle,$x,135,$bgcolor,$fontname,"tu sors," ); 
  16. imagettftext($im,$fontsize,$angle,$x,170,$bgcolor,$fontname,$texte); 
  17. imagettftext($im,$fontsize,$angle,$x,195,$bgcolor,$fontname,"et ne reviens pas !" ); 
  18. imageJPEG($im); 
  19. imagedestroy($im); 
  20. ?>


mais sa marche pas j'obtient sa:

Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/yassine/www/fichier/image.php on line 29

Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/yassine/www/fichier/image.php on line 31

Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/yassine/www/fichier/image.php on line 33

voila le script installer dans mon site: http://yassine.monespace.net/fichier/form.htm
la photo que je veux modifer: http://yassine.monespace.net/fichier/foto.jpg
pour obtenir ce resultat: http://62.212.109.174/pika/tu_sors.php?texte=Gniarf

un autre exemple:
http://62.212.109.174/pika/panneau/inde … de+Preview


Message édité par yassine1 le 22-03-2009 à 22:22:20
Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.

putenv('GDFONTPATH=' . realpath('.'));
$fontname="tahoma";

 

voir la doc : http://fr2.php.net/manual/fr/function.imagettftext.php c'est tout bien expliqué


Message édité par jerbe le 23-03-2009 à 00:02:00
------------------------------ Venez jouer sur mon site : http://www.gugusland.com
mes autres sites : http://jeremy1000.free.fr > http://jybforum.free.fr
Répondre à jerbe
Tom's Guide > Forum > Programmation > Insérer un texte dans une image
Aller à :

Il y a 1643 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Attention

Vous allez répondre sur un sujet resté inactif pendant plus de 6 mois.
Assurez-vous d'apporter des éléments nouveaux à la discussion avant de poursuivre.

Répondre Annuler
Liens