Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0tt committed Aug 11, 2023
1 parent 35f9c81 commit c1d97cb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/Services/PostService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use App\Jobs\ProcessMissingThumbnail;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Intervention\Image\Facades\Image;
use Intervention\Image\Exception\RuntimeException;
use Illuminate\Support\Facades\Storage;
use \HeadlessChromium\BrowserFactory;
use HeadlessChromium\BrowserFactory;

use App\Models\Post;
use App\Models\Collection;
Expand Down Expand Up @@ -210,7 +212,7 @@ public function getInfo(string $url, $act_as_bot = false)
return $this->getInfo($url, true);
}

if (empty($html) || !str_contains($content_type, 'text/html')) {
if (empty($html) || !Str::contains($content_type, 'text/html')) {
return [
'url' => substr($url, 0, 512),
'base_url' => substr($base_url, 0, 255),
Expand Down Expand Up @@ -316,7 +318,11 @@ public function saveImage($image_path, Post $post)
return;
}

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

0 comments on commit c1d97cb

Please sign in to comment.