Skip to content

Commit

Permalink
catch all Image Exceptions #92
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0tt committed Oct 17, 2023
1 parent d10b9a7 commit 92120f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/Services/PostService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Intervention\Image\Exception\ImageException;
use Intervention\Image\Facades\Image;
use Intervention\Image\Exception\RuntimeException;
use Illuminate\Support\Facades\Storage;
use HeadlessChromium\BrowserFactory;

Expand Down Expand Up @@ -243,7 +243,7 @@ public function getInfo(string $url, $act_as_bot = false)
$color = $meta->getAttribute('content');
} else if ($meta->getAttribute('property') === 'og:image') {
if ($meta->getAttribute('content') != '') {
$image_path = $meta->getAttribute('content');
$image_path = $meta->getAttribute('content');
if (Str::startsWith($image_path, parse_url($image_path)['path'])) {
$image_path = $this->composeImagePath($image_path, $base_url, $url);
}
Expand Down Expand Up @@ -321,10 +321,10 @@ public function saveImage($image_path, Post $post)

try {
$image = Image::make($image_path);
} catch (RuntimeException $e) {
} catch (ImageException $e) {
Log::debug('Image could not be created');
}
if (!$image) {
if (!isset($image)) {
return;
}

Expand Down

0 comments on commit 92120f3

Please sign in to comment.