mercredi 5 décembre 2018

PHP GD driver is only able to decode JPG, PNG, GIF or WebP files

I am using laravel 5.5. One of my modules requires image resize so I used GD library for it. But now if the user uploads the bmp file then the user gets Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. I don't want to use Imagick.

My PHP version is 7.1 and GD library version is 2.2.5. What I've done is as below:

public function getFileContent($file = null)
{
    if(isset($file))
    {
        $image = \Image::make($file->getRealPath());
        return $image->resize(600, 'auto')->response('png')->getContent();
    }

    return null;
}

Above code is working fine for jpg,jpeg and png



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BT0dPV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire