source = Storage::disk('images')->path($this->image->album_id . '/original/' . $this->image->id . '.avif'); $this->destination = $this->image->album_id . '/lightbox/' . $this->image->id . '.avif'; } public function handle(): void { if (method_exists($this, 'batch') && $this->batch()?->cancelled()) { return; } $lightbox = InterventionImage::read($this->source); $lightbox = $lightbox->scaleDown(height: config('gallery.image.fullscreen.height', 2000)); Storage::disk('images')->put($this->destination, $lightbox->toAvif(config('gallery.image.quality', 80))); $this->image->setLightboxSize($lightbox->width(), $lightbox->height()); } public function failed(?Throwable $exception): void { $this->image->delete(); Log::error($exception, [ 'image' => $this->image, 'source' => $this->source, 'destination' => $this->destination ]); } }