mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-30 07:44:41 +00:00
add image width variable to generation thumbnail queue action
This commit is contained in:
@@ -21,13 +21,16 @@ class CreateImageThumbnailAcionQueue
|
|||||||
// Get image from disk
|
// Get image from disk
|
||||||
$image = Storage::disk('local')->get("temp/$user_id/{$file_name}");
|
$image = Storage::disk('local')->get("temp/$user_id/{$file_name}");
|
||||||
|
|
||||||
|
// Get image width
|
||||||
|
$image_width = getimagesize(storage_path("app/temp/$user_id/{$file_name}"))[0];
|
||||||
|
|
||||||
collect($thumnails_sizes)
|
collect($thumnails_sizes)
|
||||||
->each(function ($size) use ($image, $user_id, $file_name) {
|
->each(function ($size) use ($image, $user_id, $file_name, $image_width) {
|
||||||
|
|
||||||
// Create intervention image
|
if ($image_width > $size['size']) {
|
||||||
$intervention = Image::make($image)->orientate();
|
|
||||||
|
|
||||||
if ($intervention->getWidth() > $size['size']) {
|
// Create intervention image
|
||||||
|
$intervention = Image::make($image)->orientate();
|
||||||
|
|
||||||
// Generate thumbnail
|
// Generate thumbnail
|
||||||
$intervention->resize($size['size'], null, fn ($constraint) => $constraint->aspectRatio())->stream();
|
$intervention->resize($size['size'], null, fn ($constraint) => $constraint->aspectRatio())->stream();
|
||||||
|
|||||||
Reference in New Issue
Block a user