Skip to content

Instantly share code, notes, and snippets.

@eurowebpage
Last active April 7, 2020 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eurowebpage/6f059c7096f5b6ada6d2ee4243762709 to your computer and use it in GitHub Desktop.
Save eurowebpage/6f059c7096f5b6ada6d2ee4243762709 to your computer and use it in GitHub Desktop.
ecrire-un-texte-sur-une-image
// créer un fichier exemple ds dossier inc/ textimage1.php
// et coller le code si dessous
<?php
$nom_image = "../img/vide.jpg"; // le nom de votre image avec l'extension jpeg
$texte = '#EUROWEBPAGE'; // Le texte que vous désirez écrire sur l'image
header ("Content-type: image/jpeg");
$image = imagecreatefromjpeg($nom_image);
$blanc = imagecolorallocate($image, 255, 255, 255);
imagestring($image, 25, 115, 115,$texte, $blanc);
imagejpeg($image);
?>
// Ensuite ds la page ou vous souhaitez afficher l'image avec le text
<img src="inc/textimage1.php" alt="text image" title="text image">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment