jeudi 12 octobre 2017

laravel console command. imagecreatefromjpeg throws a fatal error if the image is corrupt

The below code triggers a FatalErrorException. It works as expected when run in a route, but not as an artisan command.

$im = @imagecreatefromjpeg(resource_path('corrupt.jpg'));

if(!$im){
    echo "corrupt image..";
}

enter image description here

I've tried catching it as an Exception and FatalErrorException but can't. Likely as it's fatal and so too late.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire