Add queue setting for resizing images
This commit is contained in:
parent
0777ff7901
commit
bfb3ac206a
|
@ -1,4 +1,6 @@
|
|||
<?php namespace Aweos\Resizer;
|
||||
<?php
|
||||
|
||||
namespace Aweos\Resizer;
|
||||
|
||||
use Aweos\Resizer\Classes\CacheManager;
|
||||
use Aweos\Resizer\Classes\FileObserver;
|
||||
|
@ -7,6 +9,7 @@ use Aweos\Resizer\Classes\ResizeJob;
|
|||
use Aweos\Resizer\Console\ResizeMake;
|
||||
use Aweos\Resizer\Console\ResizePurge;
|
||||
use Aweos\Resizer\Lib\MediaPath;
|
||||
use Aweos\Resizer\Models\Setting;
|
||||
use Event;
|
||||
use Media\Classes\MediaLibrary;
|
||||
use Queue;
|
||||
|
@ -63,7 +66,7 @@ class Plugin extends PluginBase
|
|||
|
||||
Event::listen('media.file.upload', function($widget, $filePath, $uploadedFile) {
|
||||
if ((new MediaPath($filePath))->shouldProcess()) {
|
||||
Queue::push(ResizeJob::class, [$filePath]);
|
||||
Queue::push(ResizeJob::class, [$filePath], Setting::get('queue'));
|
||||
}
|
||||
});
|
||||
Event::listen('media.file.delete', function($widget, $filePath) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class ResizeMake extends Command
|
|||
if ($item->type === 'folder') {
|
||||
$this->resize($item->path);
|
||||
} else {
|
||||
Queue::push(ResizeJob::class, [$item->path, 'update' => $this->option('update', false)]);
|
||||
Queue::push(ResizeJob::class, [$item->path, 'update' => $this->option('update', false)], Setting::get('queue'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ fields:
|
|||
mode: array
|
||||
label: Breakpoints
|
||||
comment: Von diesen Werten werden Bilder generiert mit entsprechender Breite. Bitte nur die Breite in Pixel angeben. Die Höhe bestimmt sich nach der Zielgröße
|
||||
queue:
|
||||
label: Queue
|
||||
comment: Auf dieser Queue werden die Bilder generiert
|
||||
sizes:
|
||||
type: repeater
|
||||
label: Seitenverhältnisse
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Aweos\Resizer\Tests;
|
||||
|
||||
use Aweos\Resizer\Models\Setting;
|
||||
use Media\Classes\MediaLibrary;
|
||||
use PluginTestCase;
|
||||
use Storage;
|
||||
|
@ -16,6 +17,7 @@ class TestCase extends PluginTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
Setting::set('queue', 'default');
|
||||
$this->media = MediaLibrary::instance();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue