Skip to content

Commit

Permalink
Return empty string when image is not found (#242)
Browse files Browse the repository at this point in the history
* Return empty string when image is not found

* Fix styling

---------

Co-authored-by: kevinmeijer97 <[email protected]>
  • Loading branch information
kevinmeijer97 and kevinmeijer97 authored Sep 12, 2024
1 parent 7eb28c9 commit d38adac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Support\Facades\Config;
use League\Flysystem\FilesystemException;
use Statamic\Contracts\Assets\Asset;
use Statamic\Exceptions\NotFoundHttpException;
use Statamic\Facades\Blink;
use Statamic\Facades\Glide as GlideManager;
use Statamic\Imaging\ImageGenerator;
Expand Down Expand Up @@ -265,7 +266,11 @@ private function placeholder(): string
'cache' => Config::get('statamic.assets.image_manipulation.cache', false),
];

$manipulationPath = $imageGenerator->generateByAsset($this->asset, $params);
try {
$manipulationPath = $imageGenerator->generateByAsset($this->asset, $params);
} catch (NotFoundHttpException $e) {
return '';
}

$base64Image = $this->readImageToBase64($manipulationPath);

Expand Down

0 comments on commit d38adac

Please sign in to comment.