Add exception when PDF cannot be converted to image

This commit is contained in:
philipp lang 2021-10-31 12:59:34 +01:00
parent f7e7e46c02
commit 9ed63828db
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace Aweos\Resizer\Compressors;
use Aweos\Resizer\Exceptions\ResizerException;
use Illuminate\Support\Collection;
use Intervention\Image\ImageManager;
use Storage;
@ -38,6 +39,10 @@ class PdfCompressor extends Compressor
exec('convert -density 150 '.escapeshellarg($pdf.'[0]').' -quality 90 '.escapeshellarg($file), $output, $r);
if (!file_exists($file)) {
throw new ResizerException('File cannot be generated from PDF file. Root file is "'.$pdf.'"');
}
return $file;
}