Ckfinder 图像 [类型] 上传致命错误 [不支持的图像类型非资源:图像/jpeg]

问题描述

尝试使用 ckfinder 上传图像文件会导致指向不支持格式的致命错误。 使用的图片扩展名都在 config.PHP 中的 allowedExtensions

$config['resourceTypes'][] = array(
    'name'              => 'Images','directory'         => 'images','maxSize'           => 0,'allowedExtensions' => 'bmp,gif,jpeg,jpg,png','deniedExtensions'  => '','backend'           => 'default'
);

& core/connector/PHP/vendor/cksource/ckfinder/src/CKSource/CKFinder/Image.PHP(触发错误的地方。)

throw new CKFinderException('Unsupported image type (not resource): ' . $this->mime);
$supportedFormats = array(
            'image/gif'      => $gdSupportedTypes & IMG_GIF,'image/jpeg'     => $gdSupportedTypes & IMG_JPG,'image/png'      => $gdSupportedTypes & IMG_PNG,'image/wbmp'     => $gdSupportedTypes & IMG_WBMP,'image/bmp'      => $bmpSupport && ($gdSupportedTypes & IMG_JPG),'image/x-ms-bmp' => $bmpSupport && ($gdSupportedTypes & IMG_JPG)
        );

        if (!array_key_exists($this->mime,$supportedFormats) || !$supportedFormats[$this->mime]) {
            throw new CKFinderException('Unsupported image type: ' . $this->mime);
        }

        if ($this->mime === 'image/bmp' || $this->mime === 'image/x-ms-bmp') {
            $this->gdImage = $this->createFromBmp($imageData);
        } else {
            $this->gdImage = imagecreatefromstring($imageData);
        }

        if (!is_resource($this->gdImage)) {
            throw new CKFinderException('Unsupported image type (not resource): ' . $this->mime);
        }

在致命错误之前有一些不推荐使用的代码

Method ReflectionParameter::getClass())

使用,但我认为这不会导致问题?

任何提示提示将不胜感激。 笔记: 尝试用 ckfinder 的新副本替换整个 ckfinder 文件夹,但问题仍然存在,通常可以解决我面临的许多错误。 提前致谢!!!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)