diff --git a/composer.json b/composer.json index 63bd557..5b5a3bb 100644 --- a/composer.json +++ b/composer.json @@ -17,13 +17,12 @@ "license": "MIT", "minimum-stability": "dev", "require": { - "php": "^8.0", + "php": "^8.1", "ext-zip": "*", "ext-json": "*", - "laravel/framework": "^9.0|^10.0", + "laravel/framework": "^9.0|^10.0|^11.0", "league/flysystem": "^3.0", - "intervention/image": "^2.7", - "intervention/imagecache": "^2.6" + "intervention/image-laravel": "^1.2.0" }, "autoload": { "psr-4": { diff --git a/config/file-manager.php b/config/file-manager.php index 8e32e76..63fd749 100644 --- a/config/file-manager.php +++ b/config/file-manager.php @@ -61,14 +61,6 @@ */ 'rightPath' => null, - /** - * Image cache ( Intervention Image Cache ) - * - * set null, 0 - if you don't need cache (default) - * if you want use cache - set the number of minutes for which the value should be cached - */ - 'cache' => null, - /** * File manager modules configuration * diff --git a/docs/index.md b/docs/index.md index 38e6fb5..9a74eae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,9 +10,8 @@ * [Update](./update.md) ## Requirements - * PHP >= 8.0 + * PHP >= 8.1 * ext-zip - for zip and unzip functions * Laravel 9 or higher - * GD Library or Imagick for [intervention/image](https://github.com/Intervention/image) - * requires [intervention/image](https://github.com/Intervention/image) and [intervention/imagecache](https://github.com/Intervention/imagecache) + * GD Library or Imagick for [intervention/image-laravel](https://github.com/Intervention/image-laravel) * Bootstrap 5 and Bootstrap Icons v1.8.0 and higher diff --git a/src/FileManager.php b/src/FileManager.php index da1642c..aa879cd 100644 --- a/src/FileManager.php +++ b/src/FileManager.php @@ -13,7 +13,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; -use Intervention\Image\Facades\Image; +use Intervention\Image\Laravel\Facades\Image; use League\Flysystem\FilesystemException; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -314,22 +314,14 @@ public function download($disk, $path): StreamedResponse */ public function thumbnails($disk, $path): mixed { - if ($this->configRepository->getCache()) { - $thumbnail = Image::cache(function ($image) use ($disk, $path) { - $image->make(Storage::disk($disk)->get($path))->fit(80); - }, $this->configRepository->getCache()); - - // output - return response()->make( - $thumbnail, - 200, - ['Content-Type' => Storage::disk($disk)->mimeType($path)] - ); - } - - $thumbnail = Image::make(Storage::disk($disk)->get($path))->fit(80); - - return $thumbnail->response(); + return response()->make( + Image::read( + Storage::disk($disk)->get($path)) + ->coverDown(80, 80) + ->encode(), + 200, + ['Content-Type' => Storage::disk($disk)->mimeType($path)] + ); } /** @@ -339,12 +331,15 @@ public function thumbnails($disk, $path): mixed * @param $path * * @return mixed + * @throws BindingResolutionException */ public function preview($disk, $path): mixed { - $preview = Image::make(Storage::disk($disk)->get($path)); - - return $preview->response(); + return response()->make( + Image::read(Storage::disk($disk)->get($path))->encode(), + 200, + ['Content-Type' => Storage::disk($disk)->mimeType($path)] + ); } /** diff --git a/src/Services/ConfigService/ConfigRepository.php b/src/Services/ConfigService/ConfigRepository.php index 598c815..915b9ff 100644 --- a/src/Services/ConfigService/ConfigRepository.php +++ b/src/Services/ConfigService/ConfigRepository.php @@ -62,16 +62,6 @@ public function getLeftPath(): ?string; */ public function getRightPath(): ?string; - /** - * Image cache ( Intervention Image Cache ) - * - * set null, 0 - if you don't need cache (default) - * if you want use cache - set the number of minutes for which the value should be cached - * - * @return int|null - */ - public function getCache(): ?int; - /** * File manager modules configuration * diff --git a/src/Services/ConfigService/DefaultConfigRepository.php b/src/Services/ConfigService/DefaultConfigRepository.php index a0fe333..2ea4b98 100644 --- a/src/Services/ConfigService/DefaultConfigRepository.php +++ b/src/Services/ConfigService/DefaultConfigRepository.php @@ -80,19 +80,6 @@ final public function getRightPath(): ?string return config('file-manager.rightPath'); } - /** - * Image cache ( Intervention Image Cache ) - * - * set null, 0 - if you don't need cache (default) - * if you want use cache - set the number of minutes for which the value should be cached - * - * @return int|null - */ - final public function getCache(): ?int - { - return config('file-manager.cache'); - } - /** * File manager modules configuration *