PHP imagecreatefromgif()始终返回false

PHP imagecreatefromgif()始终返回false,php,image,fpdf,Php,Image,Fpdf,我使用FPDF生成PDF,并得到以下错误 FPDF error: Missing or incorrect image file 我之前猜测我的GIF图像有问题,现在我正在用PHP函数验证我的图像 image_type_to_extension() 返回gif 所以我不知道为什么 imagecreatefromgif() 返回false,导致FPDF错误。函数imagecreatefromgif()需要图像路径作为 imagecreatefromgif(“/var/www/imag

我使用FPDF生成PDF,并得到以下错误

    FPDF error: Missing or incorrect image file
我之前猜测我的GIF图像有问题,现在我正在用PHP函数验证我的图像

image_type_to_extension()
返回gif

所以我不知道为什么

imagecreatefromgif()

返回false,导致FPDF错误。

函数imagecreatefromgif()需要图像路径作为 imagecreatefromgif(“/var/www/image.gif”)

您是否发送完整路径

试一试


包括说明问题的简短程序的完整源文件。这样,我们中的一个人可能会更改路径名并运行它以查看它是否有效


顺便说一下,如果HTTP服务器正在执行PHP,则绝对路径名将不起作用。为此,映像必须位于网站内的路径中。

始终,对于每个映像?我已经让它工作了,但绝对路径是指向web目录内的路径…如果使用绝对路径而不是通过http,则会大大加快速度
if(file_exists($fullPath))
{
 $image = imagecreatefromgif($fullPath));
}
else
  die("Image Not found");