Kazdy kod który ma funkcje
imagettfbbox() u mnie nie działa,
niezależnie jak określe ścieżkę do pliku czcionki.
np.
<?php
$imgWidth = 200;
$imgHeight = 100;
$imgText = 'php5.pl';
$hImage = imagecreatetruecolor($imgWidth, $imgHeight);
$box = imagettfbbox(14, 0, 'arial.ttf', $imgText);
$x = (int
)(($imgWidth - abs(max($box[2
], $box[4
]))) / 2
); $y = (int
)(($imgHeight + abs(max($box[5
], $box[7
]))) / 2
);
imagecolorallocate($hImage, 0, 0, 0);
$white = imagecolorallocate($hImage, 255, 255, 255);
imagettftext($hImage, 14, 0, $x, $y, $white, 'arial.ttf',
$imgText);
header('Content-type: image/png'); imagepng($hImage);
?>
Oto rezultat :
Warning: imagettfbbox(): Could not find/open font in /usr/local/apache/www/htdocs/test2.php on line 9
Warning: imagettftext(): Could not find/open font in /usr/local/apache/www/htdocs/test2.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/apache/www/htdocs/test2.php:9) in /usr/local/apache/www/htdocs/test2.php on line 18
‰PNG IHDRČdLäč\PIDATxśíÁ‚ ˙ŻnH@üęÄ•|—bIEND®B`‚
Czy ktoś może mi pomóc.
Albo potwierdzi że ten kod u niego na serwerze działa prawidłowo ?
Bart