2011-01-28 88 views
1

我有一些代碼,增加了一些標頭的圖像:冠軍background.png.php的返回500內部服務器錯誤的PHP映像?

內容:

<?php 
$im = imagecreatefrompng("title-background.png"); 

header('Cache-Control: public'); 
header('Content-type: image/png'); 
header('Expires: 19 Febuary 2012 20:00:00 GMT'); 

imagepng($im); 
imagedestroy($im); 
?> 

,這就是工作的罰款。但是,當我試圖做同樣的與另一個文件,

button.png.php的內容:與500

<?php 
$im1 = imagecreatefrompng("button.png"); 

header('Cache-Control: public'); 
header('Content-type: image/png'); 
header('Expires: 19 Febuary 2012 20:00:00 GMT'); 

imagepng($im1); 
imagedestroy($im1); 
?> 

服務器返回我有我的日誌的訪問權限。

+0

你檢查了圖像的路徑嗎?你有權訪問該文件嗎? – 0x60 2011-01-28 07:28:19

+0

嘗試添加這些行到文件的開頭,以防止500錯誤,然後看看你是否得到一個PHP錯誤:`??php error_reporting(E_ALL); ini_set('display_errors','on');回聲「aaa」;使用ob_flush(); ?> – 2011-01-28 07:38:41

回答

1

哇,抱歉的傢伙 - 凌亂的stackoverflow服務器。在我的早餐上吃了1分鐘,我的工作就完成了......

title-background.png.php是從.css fie指向同一個服務器: - 但是,button.png.php來自不同的服務器!

我現在已經通過放置完整路徑來修復它,包括http://'s等。

2

我懷疑button.png不存在,不能被讀取,或者不知何故與imagecreatefrompng()不兼容。

相關問題