Nom de répertoire 
 De Michel BONZI - Mardi 27 Août 2002 à 09:56

Pour obtenir un repertoire absolu en PHP :
$fichier_de_police_abdolu=$DOCUMENT_ROOT.dirname($PHP_SELF)."/repertoire_police/".$police_de_caractere;
A noter que imagettftext NE MARCHE PAS en PHP 4.1, il faut passer a 4.2.

  Erreurs d'exécution 
 De Olivier LAFANECHERE - Lundi 9 Septembre 2002 à 12:07

Formulaire HTML :
<html>
<head>
<title>Test</title>
</head>
<body>
<h1>Tester</h1>
<form method=post action="imagettftext.php">
<input type=submit value="Tester">
</form>
</body>
</html>

Script :
<?
$image = imagecreate(200,200);
$noir = imagecolorallocate($image,0,0,0);
$blanc = imagecolorallocate($image,255,255,255);

$path_font = $DOCUMENT_ROOT.dirname($PHP_SELF)."/fontsttf/VERDANAB.TTF";
//echo "Path =".$path_font;
imagefill($image, 0, 0, $noir);
imagettftext($image, 10 ,0, 50, 50, $blanc, $path_font, "Olivier LAFANECHERE");

header ("Content-type: image/jpg");
imagejpeg($image);
imagedestroy ($image);

?>

Je ne comprends pourquoi ce script me retourne les erreurs :
Warning: Could not find/open font in c:\program files\apache group\apache\htdocs\auto7\makebutton\imagettftext.php on line 9

Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\auto7\makebutton\imagettftext.php:9) in c:\program files\apache group\apache\htdocs\auto7\makebutton\imagettftext.php on line 11
ÿØÿàJFIFÿfi>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC etc...