WIP
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Importers;
|
||||
|
||||
use App\Importers\Image\Jobs\FinishImageModification;
|
||||
use App\ImportsMedia;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Importers\Image\Jobs\{ImportImage, GenerateFullscreen, GenerateThumbnail};
|
||||
use App\Models\Image as ImageModel;
|
||||
use App\Models\Album;
|
||||
use Illuminate\Support\Facades\Bus;
|
||||
|
||||
class Image implements ImportsMedia {
|
||||
|
||||
@@ -19,16 +21,19 @@ class Image implements ImportsMedia {
|
||||
{
|
||||
}
|
||||
|
||||
public function import(): array {
|
||||
public function import(): void {
|
||||
$image = ImageModel::create([
|
||||
'album_id' => $this->location->id
|
||||
]);
|
||||
$imageId = $image->id;
|
||||
|
||||
return [
|
||||
Bus::chain([
|
||||
new ImportImage($this->file->getPathname(), $image),
|
||||
new GenerateFullscreen($image),
|
||||
new GenerateThumbnail($image),
|
||||
];
|
||||
Bus::batch([
|
||||
new GenerateFullscreen($image),
|
||||
new GenerateThumbnail($image),
|
||||
]),
|
||||
new FinishImageModification($image),
|
||||
])->dispatch();
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class GenerateFullscreen implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->batch()->cancelled()) {
|
||||
if (method_exists($this, 'batch') && $this->batch()?->cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class GenerateThumbnail implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->batch()->cancelled()) {
|
||||
if (method_exists($this, 'batch') && $this->batch()?->cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class ImportImage implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->batch()->cancelled()) {
|
||||
if (method_exists($this, 'batch') && $this->batch()?->cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user