2011-09-02 125 views
0

我的環境是php 5.2,現在是php 5.3。 當我移動的網站新的環境,它顯示的錯誤php函數錯誤警告

錯誤警告:

Fatal error: Call to undefined function imagecreatefrompng() in xx/application/libraries/crop2.php on line 537 

和錯誤代碼是在下面的代碼第九行:

protected function IM($file) 
{ 
    if(!file_exists($file)) die('File not exists.'); 
    $info = getimagesize($file); 
    switch($info['mime']) 
    { 
     case 'image/gif': 
     $mim = imagecreatefromgif($file); 
     break; 
     case 'image/png': 
     $mim = imagecreatefrompng($file); // the error line 
     imagealphablending($mim, false); 
     imagesavealpha($mim, true); 
     break; 
     case 'image/jpeg': 
     $mim = imagecreatefromjpeg($file); 
     break; 
     default: 
     die('File format errors.'); 
    } 
    return $mim; 
} 

我應該如何改變它?

+1

顯然你的新環境沒有安裝或啓用PHP-GD。 – animuson

+1

'phpinfo()'並搜索'GD' – zerkms

回答

1

phpinfo()的幫助下,檢查您的GD library for PHP installed是否有效。似乎它缺少。