imagecreatefrompng is not a valid PNG file
图片格式判断的坑,不要单纯判断后缀名获取图片格式,请使用 getimagesize
获取图像信息再判断。
$ename=getimagesize($picname);
$ename=explode('/',$ename['mime']);
$ext=$ename[1];
switch($ext){
case "png":
$image=imagecreatefrompng($picname);
break;
case "jpeg":
$image=imagecreatefromjpeg($picname);
break;
case "jpg":
$image=imagecreatefromjpeg($picname);
break;
case "gif":
$image=imagecreatefromgif($picname);
break;
}