SOG MH
SOG MH

Reputation: 13

Ckfinder Fatal error on image [type] upload [Unsupported image type (not resource): image/jpeg]

trying to upload an image file using ckfinder is resulting in a fatal error pointing to not support format. image extensions used are all within allowedExtensions in config.php

$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 (where the error is being triggered from.)

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);
        }

theres some deprecated code prior to the fatal error

Method ReflectionParameter::getClass())

usage but I don't think that is causing an issue?

any tips or hints would be greatly appreciated. NOTE: Tried replacing the entire ckfinder folder with a new copy of ckfinder, but the issue still remains, usually that fixes a lot of the errors I face. Thanks in advance!!!

Upvotes: 0

Views: 624

Answers (1)

fbo
fbo

Reputation: 11

the same occurred for me today when I switched from php7 to 8.0.8. but installing the latest 3.5.2 of ckFinder solved the problem here (You did not provide any version number, so I dont know this comment is helpfull at all)

Upvotes: 1

Related Questions