1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| //On affiche la photo
function LoadJpeg($imgname) {
$im = @imagecreatefromjpeg($imgname);
if (!$im) { // Vérification
$im = imagecreatetruecolor(150, 30); // Création d'une image blanche
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
// Affichage d'un message d'erreur
imagestring($im, 1, 5, 5, "Erreur de chargement de l'image $imgname", $tc);
}
return $im;
}
header("Content-Type: image/jpeg");
$photo = "photos/photo".$numéro.".jpg";
$img = LoadJpeg($photo);
imagejpeg($img);
echo "Cette instruction ne fonctionne pas."; |
Partager