Joomla 1.5 を使用しています。テキストの上に画像を作成するためのスクリプトがありますが、うまくいきません:
<?php
// Set the content-type
header('Content-Type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = "ARIAL.TFF";
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
これが機能しない理由がわかりません。Googleで多くの例を見つけて使用しましたが、常に同じです。
英語でのこのエラーは、次を意味しますImage "http://juokoera.lt/a.php" can't be shown, because It have problems (errors)
。
私はグーグルで見つけました、それは私のホスティングのせいかもしれません、私はそれを変更しましたが、同じ問題です. できれば助けてください。どうもありがとうございました。
更新: コードが次のようになると、同じエラーが発生しました。
dasfasdf
dfas
<?php
header('Content-Type: image/png');
$im = imagecreatetruecolor(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
$text = 'Testing...';
$font = "ARIAL.TTF";
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
imagepng($im);
imagedestroy($im); ?>
同じphpで追加のテキストを使用するにはどうすればよいですか?