【发布时间】:2016-06-09 14:43:01
【问题描述】:
我有一个 php 脚本 cakeChart.php 正在生成简单的蛋糕。
$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 将其转换为缩略图?
【问题讨论】:
标签: php png thumbnails gd