好的,我的问题是我想在生成后在网页上显示动态生成的图像,并为用户提供使用图像的链接。当我尝试回显图像时:
echo '<img src="link/sig.php?username='.$_GET['username'].'&fakeparm=.png />';
网页显示图像很好,但添加了一百万个奇怪的字符。下面是图像创建片段。
$image_link = 'image.png';
$image = imagecreatefrompng($image_link);
$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 3;
$x = array('28', '80', '135', '188', '240');
$y = array('8', '29', '52', '77', '100');
$i = '0';
$a = '0';
foreach($stat as $s_key => $value){
imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour);
$i++;
if($i == '5'){
$i = '0';
$a++;
}
}
imagestring($image, $font_size, '230', '100', 'Total:'. $overall[1], $font_colour);
imagestring($image, $font_size, '240', '75', '' . $username, $font_colour);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
的值$stat
。
$stats = explode("\n", $website);
$overall = explode(",", $stats[0]);
$stat['att'] = explode(",", $stats[1]);
$stat['def'] = explode(",", $stats[2]);
$stat['str'] = explode(",", $stats[3]);
$stat['hp'] = explode(",", $stats[4]);
$stat['rng'] = explode(",", $stats[5]);
$stat['pry'] = explode(",", $stats[6]);
$stat['mag'] = explode(",", $stats[7]);
$stat['ck'] = explode(",", $stats[8]);
$stat['wc'] = explode(",", $stats[9]);
$stat['flt'] = explode(",", $stats[10]);
$stat['fsh'] = explode(",", $stats[11]);
$stat['fm'] = explode(",", $stats[12]);
$stat['cra'] = explode(",", $stats[13]);
$stat['smi'] = explode(",", $stats[14]);
$stat['min'] = explode(",", $stats[15]);
$stat['her'] = explode(",", $stats[16]);
$stat['ag'] = explode(",", $stats[17]);
$stat['th'] = explode(",", $stats[18]);
$stat['sl'] = explode(",", $stats[19]);
$stat['frm'] = explode(",", $stats[20]);
$stat['rc'] = explode(",", $stats[21]);
$stat['hun'] = explode(",", $stats[22]);
$stat['cs'] = explode(",", $stats[23]);
注意:图像生成正常,一切正常...我想在网页上显示生成的图像,而不是转发到图像本身...