My provious environment is php 5.2, now is php 5.3. When I moved the website to new environment, it shows the error
The error warning is:
Fatal error: Call to undefined function imagecreatefrompng() in xx/application/libraries/crop2.php on line 537
and the error code is the ninth line in the following code:
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;
}
How should I change it?
1 Answer 1
With the help of phpinfo() check whether you have GD library for PHP installed. Seems like it's missing.
Vishwanath Dalvi
36.9k41 gold badges128 silver badges156 bronze badges
answered Sep 2, 2011 at 4:08
s.webbandit
17.2k17 gold badges60 silver badges83 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-php
phpinfo()and search forGD