mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-22 17:32:14 +00:00
fix thumbnail generation mutated data
This commit is contained in:
@@ -16,20 +16,17 @@ class CreateImageThumbnailAcionQueue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute($file_name, $user_id, $thumnails_sizes)
|
||||
{
|
||||
|
||||
public function execute($file_name, $user_id, $thumnails_sizes, $source)
|
||||
{
|
||||
// Get image from disk
|
||||
$image = Storage::disk('local')->get("temp/$user_id/{$file_name}");
|
||||
|
||||
// Create intervention image
|
||||
$intervention = Image::make($image)->orientate();
|
||||
|
||||
|
||||
collect($thumnails_sizes)
|
||||
->each(function ($size) use ($intervention, $user_id, $file_name) {
|
||||
|
||||
dd($intervention->getWidth());
|
||||
|
||||
->each(function ($size) use ($image, $user_id, $file_name) {
|
||||
|
||||
// Create intervention image
|
||||
$intervention = Image::make($image)->orientate();
|
||||
|
||||
if ($intervention->getWidth() > $size['size']) {
|
||||
|
||||
// Generate thumbnail
|
||||
@@ -40,5 +37,11 @@ class CreateImageThumbnailAcionQueue
|
||||
}
|
||||
});
|
||||
|
||||
if($source === 'queue') {
|
||||
|
||||
// Delete file after generate a thumbnail
|
||||
Storage::disk('local')->delete("temp/$user_id/{$file_name}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class CreateImageThumbnailAction
|
||||
Storage::disk('local')->copy("files/$user_id/{$file_name}", "temp/$user_id/{$file_name}");
|
||||
|
||||
// Create thumbnail instantly
|
||||
$this->action->execute($file_name, $user_id, config('vuefilemanager.image_sizes.execute'));
|
||||
$this->action->execute($file_name, $user_id, config('vuefilemanager.image_sizes.execute'), 'execute');
|
||||
|
||||
// Create thumbnail queue job
|
||||
$this->action->onQueue()->execute($file_name, $user_id, config('vuefilemanager.image_sizes.queue'));
|
||||
$this->action->onQueue()->execute($file_name, $user_id, config('vuefilemanager.image_sizes.queue'), 'queue');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user