From 8f7981456134d7ce727ecf5872d5c6f7edd7e3c9 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 20 Sep 2023 11:00:47 +0200 Subject: [PATCH] wait #6296 @0.25 --- app/Fluidbook/Farm.php | 6 +++--- app/Models/FluidbookPublication.php | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Fluidbook/Farm.php b/app/Fluidbook/Farm.php index b281e7bfe..77297099b 100644 --- a/app/Fluidbook/Farm.php +++ b/app/Fluidbook/Farm.php @@ -150,7 +150,7 @@ class Farm if (file_exists($path)) { return $path; } - return self::_getFile($params); + return self::_getFile($params, 0); }); if ((!$res || !file_exists($res)) && $attempts > 0) { @@ -193,10 +193,10 @@ class Farm if (!$res) { if ($attempts > 0) { - Log::warning('Farm failure : ' . $log); + Log::warning('Farm failure : ' . $output); return static::_getFile($params, $attempts - 1); } - throw new \Exception('Farm failure : ' . $log); + throw new \Exception('Farm failure : ' . $output); } return $res; diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index b03fdc6cb..aff48a084 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -53,7 +53,6 @@ use Cubist\Util\Json; use Cubist\Util\Str; use Datetime; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; @@ -434,8 +433,11 @@ class FluidbookPublication extends ToolboxSettingsModel $thumbpdf = $this->getAssetDir() . $this->pdfThumbnails; if (file_exists($thumbpdf)) { - $res = Farm::getFileFromPDF($thumbpdf, $page, $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $version, null, $force); - return $res; + try { + return Farm::getFileFromPDF($thumbpdf, $page, $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $version, null, $force, 1); + } catch (\Exception $e) { + throw new \Exception('Unable to generate thumbnails file from custom PDF "' . $this->pdfThumbnails . '" (original message : ' . $e->getMessage().')'); + } } else { } } -- 2.39.5