NOW MANAGED ON CODEBERG
Deps: Updated intervention library from 2 to 3
Dan Brown2345fd467778
diff --git a/app/Uploads/ImageResizer.php b/app/Uploads/ImageResizer.phpindex 4dc1b0b99..d09177fff 100644--- a/app/Uploads/ImageResizer.php+++ b/app/Uploads/ImageResizer.php@@ -6,8 +6,12 @@ use BookStack\Exceptions\ImageUploadException;use Exception;use GuzzleHttp\Psr7\Utils;use Illuminate\Support\Facades\Cache;-use Intervention\Image\Gd\Driver;-use Intervention\Image\Image as InterventionImage;+use Intervention\Image\Decoders\BinaryImageDecoder;+use Intervention\Image\Drivers\Gd\Driver;+use Intervention\Image\Encoders\AutoEncoder;+use Intervention\Image\Encoders\PngEncoder;+use Intervention\Image\Interfaces\ImageInterface as InterventionImage;+use Intervention\Image\ImageManager;class ImageResizer{@@ -124,15 +128,17 @@ class ImageResizer$this->orientImageToOriginalExif($thumb, $imageData);if ($keepRatio) {- $thumb->resize($width, $height, function ($constraint) {- $constraint->aspectRatio();- $constraint->upsize();- });+ $thumb->scaleDown($width, $height);} else {- $thumb->fit($width, $height);+ $thumb->cover($width, $height);}- $thumbData = (string) $thumb->encode($format);+ $encoder = match ($format) {+ 'png' => new PngEncoder(),+ default => new AutoEncoder(),+ };++ $thumbData = (string) $thumb->encode($encoder);// Use original image data if we're keeping the ratio// and the resizing does not save any space.@@ -150,8 +156,9 @@ class ImageResizer*/protected function interventionFromImageData(string $imageData): InterventionImage{- $driver = new Driver();- return $driver->decoder->initFromBinary($imageData);+ $manager = new ImageManager(new Driver());++ return $manager->read($imageData, BinaryImageDecoder::class);}/**diff --git a/composer.json b/composer.jsonindex 7a39c41b2..2dce05d38 100644--- a/composer.json+++ b/composer.json@@ -21,7 +21,7 @@"barryvdh/laravel-snappy": "^1.0","doctrine/dbal": "^3.5","guzzlehttp/guzzle": "^7.4",- "intervention/image": "^2.7",+ "intervention/image": "^3.5","laravel/framework": "^10.10","laravel/socialite": "^5.10","laravel/tinker": "^2.8",diff --git a/composer.lock b/composer.lockindex 9738b9117..be9190b1c 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": "5c83a032875be7a7edcfd5a18264ac7d",+ "content-hash": "e05f9f4344c239682f6a9fbab0f87cf0","packages": [{"name": "aws/aws-crt-php",@@ -1859,51 +1859,103 @@],"time": "2023-12-03T19:50:20+00:00"},+ {+ "name": "intervention/gif",+ "version": "4.0.2",+ "source": {+ "type": "git",+ "url": "https://github.com/Intervention/gif.git",+ "reference": "c2b07d1f69709e196c8b4ced423449a7e0f3b925"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/Intervention/gif/zipball/c2b07d1f69709e196c8b4ced423449a7e0f3b925",+ "reference": "c2b07d1f69709e196c8b4ced423449a7e0f3b925",+ "shasum": ""+ },+ "require": {+ "php": "^8.1"+ },+ "require-dev": {+ "phpstan/phpstan": "^1",+ "phpunit/phpunit": "^9",+ "slevomat/coding-standard": "~8.0",+ "squizlabs/php_codesniffer": "^3.8"+ },+ "type": "library",+ "autoload": {+ "psr-4": {+ "Intervention\\Gif\\": "src"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "MIT"+ ],+ "authors": [+ {+ "name": "Oliver Vogel",+ "email": "[email protected]",+ "homepage": "https://intervention.io/"+ }+ ],+ "description": "Native PHP GIF Encoder/Decoder",+ "homepage": "https://github.com/intervention/gif",+ "keywords": [+ "animation",+ "gd",+ "gif",+ "image"+ ],+ "support": {+ "issues": "https://github.com/Intervention/gif/issues",+ "source": "https://github.com/Intervention/gif/tree/4.0.2"+ },+ "funding": [+ {+ "url": "https://paypal.me/interventionio",+ "type": "custom"+ },+ {+ "url": "https://github.com/Intervention",+ "type": "github"+ }+ ],+ "time": "2024-02-18T15:36:58+00:00"+ },{"name": "intervention/image",- "version": "2.7.2",+ "version": "3.5.0","source": {"type": "git","url": "https://github.com/Intervention/image.git",- "reference": "04be355f8d6734c826045d02a1079ad658322dad"+ "reference": "408d3655c7705339e8c79731ea7efb51546cfa10"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad",- "reference": "04be355f8d6734c826045d02a1079ad658322dad",+ "url": "https://api.github.com/repos/Intervention/image/zipball/408d3655c7705339e8c79731ea7efb51546cfa10",+ "reference": "408d3655c7705339e8c79731ea7efb51546cfa10","shasum": ""},"require": {- "ext-fileinfo": "*",- "guzzlehttp/psr7": "~1.1 || ^2.0",- "php": ">=5.4.0"+ "ext-mbstring": "*",+ "intervention/gif": "^4.0.1",+ "php": "^8.1"},"require-dev": {- "mockery/mockery": "~0.9.2",- "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"+ "mockery/mockery": "^1.6",+ "phpstan/phpstan": "^1",+ "phpunit/phpunit": "^10.0",+ "slevomat/coding-standard": "~8.0",+ "squizlabs/php_codesniffer": "^3.8"},"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"+ "ext-exif": "Recommended to be able to read EXIF data properly."},"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\\Image\\": "src"}},"notification-url": "https://packagist.org/downloads/",@@ -1917,19 +1969,19 @@"homepage": "https://intervention.io/"}],- "description": "Image handling and manipulation library with support for Laravel integration",- "homepage": "http://image.intervention.io/",+ "description": "PHP image manipulation",+ "homepage": "https://image.intervention.io/","keywords": ["gd","image","imagick",- "laravel",+ "resize","thumbnail","watermark"],"support": {"issues": "https://github.com/Intervention/image/issues",- "source": "https://github.com/Intervention/image/tree/2.7.2"+ "source": "https://github.com/Intervention/image/tree/3.5.0"},"funding": [{@@ -1941,7 +1993,7 @@"type": "github"}],- "time": "2022-05-21T17:30:32+00:00"+ "time": "2024-03-13T16:26:15+00:00"},{"name": "knplabs/knp-snappy",