php函数错误警告
问题描述:
我的环境是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;
}
我应该如何改变它?
答
在phpinfo()
的帮助下,检查您的GD library for PHP installed
是否有效。似乎它缺少。
显然你的新环境没有安装或启用PHP-GD。 – animuson
'phpinfo()'并搜索'GD' – zerkms