PDA

View Full Version : Font bastardo su imagettftext();


race2
01-08-2007, 10:49
Salve,
non riesco ad assegnare un altro font che non sia un nome singolo, se metto "Arial Black" non funziona piu', mi sapete dire come mai ???

Error:
-----------------
Warning: imagettftext() [function.imagettftext]: Could not find/open font


<?
$string = "pippo!!!";

$img = imagecreatefromgif("security_background2.gif");
$colour1 = imagecolorallocate($img, 190, 190, 190);
$colour2 = imagecolorallocate($img, 0, 0, 0);
$font = 'Arial';
$angle = rand(0, 0);

imagettftext($img, 50, $angle, 13, 103, $colour2, $font, $string);
imagettftext($img, 50, $angle, 10, 100, $colour1, $font, $string);

imagegif($img, "myImgOut.gif");
?>

<img src="myImgOut.gif">



oppure :
-----------------------------
Esiste un altro modo per creare FISICAMENTE in immagine trasparente contenente la scritta che voglio io con il font che voglio io ???

andbin
01-08-2007, 10:56
non riesco ad assegnare un altro font che non sia un nome singolo, se metto "Arial Black" non funziona piu', mi sapete dire come mai ???imagettftext si aspetta un nome (con eventuale path) di un file reale in formato True-Type.

E per quanto riguarda gli spazi, c'è una nota sul manuale:
When using versions of the GD library lower than 2.0.18, a space character, rather than a semicolon, was used as the 'path separator' for different font files. Unintentional use of this feature will result in the warning message: Warning: Could not find/open font. For these affected versions, the only solution is moving the font to a path which does not contain spaces.

race2
01-08-2007, 11:28
ok, funziona, grazie mille!