[PLUGIN][ImageEncoder] If vips doesn't support, don't throw exception, just let other plugin try

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-26 21:52:18 +00:00
parent 838510ced2
commit 58715f1733
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 4 additions and 5 deletions

View File

@ -34,7 +34,6 @@ use App\Util\Formatting;
use App\Util\TemporaryFile; use App\Util\TemporaryFile;
use Exception; use Exception;
use Jcupitt\Vips; use Jcupitt\Vips;
use Plugin\ImageEncoder\Exception\UnsupportedFileTypeException;
use SplFileInfo; use SplFileInfo;
/** /**
@ -100,8 +99,8 @@ class ImageEncoder extends Plugin
try { try {
$image = Vips\Image::newFromFile($file->getRealPath(), ['access' => 'sequential']); $image = Vips\Image::newFromFile($file->getRealPath(), ['access' => 'sequential']);
} catch (Vips\Exception $e) { } catch (Vips\Exception $e) {
Log::debug("ImageEncoder's Vips couldn't handle the image file, failed with {$e}."); Log::debug("ImageEncoder's Vips couldn't handle the image file, failed with {$e->getMessage()}.", [$e]);
throw new UnsupportedFileTypeException(_m("Unsupported image file with {$mimetype}.", previous: $e)); return false;
} }
$width = $image->width; $width = $image->width;
$height = $image->height; $height = $image->height;
@ -154,8 +153,8 @@ class ImageEncoder extends Plugin
try { try {
$image = Vips\Image::newFromFile($file->getRealPath(), ['access' => 'sequential']); $image = Vips\Image::newFromFile($file->getRealPath(), ['access' => 'sequential']);
} catch (Vips\Exception $e) { } catch (Vips\Exception $e) {
Log::debug("ImageEncoder's Vips couldn't handle the image file, failed with {$e}."); Log::debug("ImageEncoder's Vips couldn't handle the image file, failed with {$e->getMessage()}.", [$e]);
throw new UnsupportedFileTypeException(_m("Unsupported image file with {$mimetype}.", previous: $e)); return false;
} }
$width = $image->width; $width = $image->width;
$height = $image->height; $height = $image->height;