diff --git a/Blacklight/ReleaseImage.php b/Blacklight/ReleaseImage.php index baed05b02..c76e345a0 100755 --- a/Blacklight/ReleaseImage.php +++ b/Blacklight/ReleaseImage.php @@ -3,11 +3,9 @@ namespace Blacklight; use Illuminate\Support\Facades\File; -use Intervention\Image\Exception\ImageException; -use Intervention\Image\Exception\NotFoundException; -use Intervention\Image\Exception\NotReadableException; -use Intervention\Image\Exception\NotWritableException; -use Intervention\Image\Facades\Image; +use Intervention\Image\Drivers\Imagick\Driver; +use Intervention\Image\Exceptions\NotWritableException; +use Intervention\Image\ImageManager; use Spatie\LaravelImageOptimizer\Facades\ImageOptimizer; /** @@ -58,11 +56,12 @@ class ReleaseImage $this->vidSavePath = storage_path('covers/video/'); } - protected function fetchImage(string $imgLoc): \Intervention\Image\Image|bool + protected function fetchImage(string $imgLoc): bool|\Intervention\Image\Interfaces\ImageInterface { try { - $img = Image::make($imgLoc); - } catch (NotFoundException $e) { + $manager = new ImageManager(Driver::class); + $img = $manager->read(file_get_contents($imgLoc)); + } catch (\Exception $e) { if ($e->getCode() === 404) { $this->colorCli->notice('Data not available on server'); } elseif ($e->getCode() === 503) { @@ -72,17 +71,8 @@ class ReleaseImage } $img = false; - } catch (NotReadableException $e) { + } catch (\Error $e) { $this->colorCli->climate()->info($e->getMessage()); - - $img = false; - } catch (ImageException $e) { - $this->colorCli->climate()->error('Image error: '.$e->getMessage()); - - $img = false; - } catch (\ImagickException $e) { - $this->colorCli->climate()->error('Image error: '.$e->getMessage()); - $img = false; } @@ -120,7 +110,7 @@ class ReleaseImage $cover->resize($new_width, $new_height); if ($saveThumb) { - $cover->save($imgSavePath.$imgName.'_thumb.jpg'); + $cover->toJpeg(100)->save($imgSavePath.$imgName.'_thumb.jpg'); //Optimize the thumbnail. ImageOptimizer::optimize($imgSavePath.$imgName.'_thumb.jpg'); } @@ -129,7 +119,7 @@ class ReleaseImage // Store it on the hard drive. $coverPath = $imgSavePath.$imgName.'.jpg'; try { - $cover->save($coverPath); + $cover->toJpeg(100)->save($coverPath); //Optimize the image. ImageOptimizer::optimize($coverPath); } catch (NotWritableException $e) { diff --git a/composer.json b/composer.json index 9167a5a7c..5564b5620 100644 --- a/composer.json +++ b/composer.json @@ -63,8 +63,7 @@ "google/recaptcha": "^1.3", "guzzlehttp/guzzle": "^7.2", "imdbphp/imdbphp": "^8.1", - "intervention/image": "^2.7", - "intervention/imagecache": "^2.6", + "intervention/image": "^3.0.1", "james-heinrich/getid3": "1.9.*", "jamesmills/laravel-timezone": "^1.13", "joshpinkney/tv-maze-php-api": "dev-master", diff --git a/composer.lock b/composer.lock index 9b130ff49..962780204 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c39ce73b3e28c76524fdad2bc55016a4", + "content-hash": "d3c7fdba6367788630b0ab603ce98914", "packages": [ { "name": "aharen/omdbapi", @@ -3096,50 +3096,30 @@ "time": "2023-03-14T23:52:55+00:00" }, { - "name": "intervention/image", - "version": "2.7.2", + "name": "intervention/gif", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/Intervention/image.git", - "reference": "04be355f8d6734c826045d02a1079ad658322dad" + "url": "https://github.com/Intervention/gif.git", + "reference": "cfececc760862f075a52acf747031bad08c8301b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad", - "reference": "04be355f8d6734c826045d02a1079ad658322dad", + "url": "https://api.github.com/repos/Intervention/gif/zipball/cfececc760862f075a52acf747031bad08c8301b", + "reference": "cfececc760862f075a52acf747031bad08c8301b", "shasum": "" }, "require": { - "ext-fileinfo": "*", - "guzzlehttp/psr7": "~1.1 || ^2.0", - "php": ">=5.4.0" + "php": "^8.0" }, "require-dev": { - "mockery/mockery": "~0.9.2", - "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" - }, - "suggest": { - "ext-gd": "to use GD library based image processing.", - "ext-imagick": "to use Imagick based image processing.", - "intervention/imagecache": "Caching extension for the Intervention Image library" + "phpstan/phpstan": "^1", + "phpunit/phpunit": "^9" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - }, - "laravel": { - "providers": [ - "Intervention\\Image\\ImageServiceProvider" - ], - "aliases": { - "Image": "Intervention\\Image\\Facades\\Image" - } - } - }, "autoload": { "psr-4": { - "Intervention\\Image\\": "src/Intervention/Image" + "Intervention\\Gif\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3153,61 +3133,48 @@ "homepage": "https://intervention.io/" } ], - "description": "Image handling and manipulation library with support for Laravel integration", - "homepage": "http://image.intervention.io/", + "description": "Native PHP GIF Encoder/Decoder", + "homepage": "https://github.com/intervention/gif", "keywords": [ + "animation", "gd", - "image", - "imagick", - "laravel", - "thumbnail", - "watermark" + "gif", + "image" ], "support": { - "issues": "https://github.com/Intervention/image/issues", - "source": "https://github.com/Intervention/image/tree/2.7.2" + "issues": "https://github.com/Intervention/gif/issues", + "source": "https://github.com/Intervention/gif/tree/3.0.0" }, - "funding": [ - { - "url": "https://paypal.me/interventionio", - "type": "custom" - }, - { - "url": "https://github.com/Intervention", - "type": "github" - } - ], - "time": "2022-05-21T17:30:32+00:00" + "time": "2023-11-27T18:54:30+00:00" }, { - "name": "intervention/imagecache", - "version": "2.6.0", + "name": "intervention/image", + "version": "3.0.1", "source": { "type": "git", - "url": "https://github.com/Intervention/imagecache.git", - "reference": "86136575a62d3634b51f196a998fce4a583b49bb" + "url": "https://github.com/Intervention/image.git", + "reference": "f17fe7bb54ec18d75588f527052069a6e9b5d720" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/imagecache/zipball/86136575a62d3634b51f196a998fce4a583b49bb", - "reference": "86136575a62d3634b51f196a998fce4a583b49bb", + "url": "https://api.github.com/repos/Intervention/image/zipball/f17fe7bb54ec18d75588f527052069a6e9b5d720", + "reference": "f17fe7bb54ec18d75588f527052069a6e9b5d720", "shasum": "" }, "require": { - "illuminate/cache": "^5.5|~6|~7|~8|~9|~10", - "illuminate/filesystem": "^5.5|~6|~7|~8|~9|~10", - "intervention/image": "~2.2", - "nesbot/carbon": "^2.39", - "opis/closure": "^3.5", - "php": "~7.2|~8" + "ext-mbstring": "*", + "intervention/gif": "^3", + "php": "^8.1" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^1", + "phpunit/phpunit": "^9" }, "type": "library", "autoload": { "psr-4": { - "Intervention\\Image\\": "src/Intervention/Image" + "Intervention\\Image\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3218,21 +3185,22 @@ { "name": "Oliver Vogel", "email": "oliver@intervention.io", - "homepage": "http://intervention.io/" + "homepage": "https://intervention.io/" } ], - "description": "Caching extension for the Intervention Image Class", - "homepage": "https://image.intervention.io", + "description": "PHP image manipulation", + "homepage": "https://image.intervention.io/", "keywords": [ - "cache", "gd", "image", "imagick", - "laravel" + "resize", + "thumbnail", + "watermark" ], "support": { - "issues": "https://github.com/Intervention/imagecache/issues", - "source": "https://github.com/Intervention/imagecache/tree/2.6.0" + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/3.0.1" }, "funding": [ { @@ -3244,8 +3212,7 @@ "type": "github" } ], - "abandoned": true, - "time": "2023-02-25T19:40:47+00:00" + "time": "2023-12-09T10:10:43+00:00" }, { "name": "james-heinrich/getid3",