PHP-GD2已激活,但不建立圖片

PHP-GD2已激活,但不建立圖片

我的 PC 上有 Ubuntu 14.04,Apache2 作為網頁伺服器,PHP 5.5.9 作為解譯器。我使用 APT 安裝了 php5-gd 軟體包,重新啟動伺服器並檢查 GD 是否處於活動狀態:

php -i | grep -i --color gd

輸出是:

/etc/php5/cli/conf.d/20-gd.ini,
gd
GD Support => enabled
GD Version => 2.1.1-dev
gd.jpeg_ignore_warning => 0 => 0
GDM_LANG => de_DE
GDMSESSION => ubuntu
_SERVER["GDM_LANG"] => de_DE
_SERVER["GDMSESSION"] => ubuntu

我想用以下程式碼片段測試庫:

<?php
$bild = imagecreatetruecolor(200,250);
$weiss = imagecolorallocate($bild, 255, 255, 255);
$mittelblau = imagecolorallocate($bild, 203, 215, 230);

imagefill($bild, 0, 0, $mittelblau);
imagejpeg($bild, "test.jpg");
?>

PHP 沒有建立圖片。我嘗試直接輸出圖像(是的,我使用了標頭),但 Firefox 說圖像已損壞。

我希望smb。可以幫我

此致

諾埃爾

編輯: phpinfo() 說,與 GD 相關的所有內容都已啟動。

答案1

我解開了這個謎團。問題是檔案權限。

相關內容