那麼,Painty 應該是產生的圖像。請確保您已正確設置你的頭,按painty.php的說明:
$config = array(
'input' => $_GET['html'],
'output' => "png",
'width' => 400,
'height' => 300,
'font_path' => "./",
'font' => "tahoma.ttf",
'font_bold' => "tahoma.ttf",
'' => ''
);
$str = $config['input'];
if(get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
$im = painty($str);
//Set header. secured from header injection.
最重要的部分:
header("Content-Type: image/".str_replace("\r\n", "", $config['output']));
imagepng($im);
的header
命令告訴服務器到文件當作圖像 - 即使它可能被命名爲image-generator.php
。如果你將這個文件看作一個形象,以及,它應該是罰款:
<a href="image-generator.php?username=foo&level=36&class=Demoman">
<img src="image-generator.php?username=foo&level=36&class=Demoman" />
</a>
這是假設image-generator.php
已被設置爲接受$ _ POST數據。然後image-generator.php
從該數據創建一個HTML文件,並將其作爲輸入發送給Painty。
祝你好運!