0
我有一個PHP腳本cakeChart.php
這是生成簡單的蛋糕。PHP gd縮小生成圖像
$image = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
在文件createThumb.php
我想從cakeChart.php
加載產生的圖像。 喜歡的東西(我知道這是壞的):
$pngImage = imagecreatefrompng("pieChart.php");
我想使這個圖像的縮略圖。眼下這個php文件的唯一引用是這個
<a href="pieChart.php" target="blank">PHP pie chart</a><br>
但我想,以取代這段文字與tumb,whitch將在createThumb.php
產生。是否可以用cakeChart.php
製作圖像,然後用createThumb.php
將它轉換爲縮略圖?