そこで、このページを作成する PHP コードをここに取り、それを新しい .php ファイルの中に入れて、そのファイルをここにアップロードしました。
画面に大量のゴミ文字が表示されます。何か案は?
以下は、完全な PHP です。
<html>
<head>
<title></title>
</head>
<body>
<?
// gif is more appropriate than jpg for this kind of image
header("Content-type: image/gif");
// both coupon.jpg and Helvetica.ttf must be located in the same directory as
// dynamic.php or these variables must be updated.
$imgname = "./coupon.jpg";
$fontname = "./Helvetica.ttf";
// read image from disk
$im = imagecreatefromjpeg( $imgname )
or die("Source coupon image has been moved or renamed! Expected coupon.jpg");
// variable allocation
$size = 11;
$textheight = 250;
$imwidth = imagesx( $im );
$black = imagecolorallocate( $im, 0,0,0 );
// create the string containing tomorrow's date
$text = "Offer expires " .
date('l\, F j\, Y', mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))).".";
// learn the width of the newly allocated string
$bbox = imagettfbbox( $size, 0, $fontname, $text );
$width = $bbox[2] - $bbox[0];
// update, display, and clear from memory the newly modified image
imagettftext($im,$size,0,$imwidth/2 - $width/2,$textheight,$black,$fontname,$text);
imagegif($im);
imagedestroy($im);
?>
</body>
</html>
更新の追加: 私の目標は、新しいページ/PHP で生成された画像に Google アナリティクス変換スクリプトを配置することです。それは可能ですか?