Skip to content

Commit

Permalink
laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
alexusmai committed May 11, 2024
1 parent c586cd8 commit fdc02fe
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 58 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 0 additions & 8 deletions config/file-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
5 changes: 2 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 15 additions & 20 deletions src/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)]
);
}

/**
Expand All @@ -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)]
);
}

/**
Expand Down
10 changes: 0 additions & 10 deletions src/Services/ConfigService/ConfigRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
13 changes: 0 additions & 13 deletions src/Services/ConfigService/DefaultConfigRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit fdc02fe

Please sign in to comment.