podcastartgenerator/site/app/Jobs/OptimizeAvatarJob.php

37 lines
794 B
PHP
Raw Normal View History

<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use ImageOptimizer;
use Illuminate\Support\Facades\Log;
class OptimizeAvatarJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $path;
/**
* Create a new job instance.
*/
public function __construct($path)
{
$this->path = $path;
}
/**
* Execute the job.
*/
public function handle(): void
{
Log::info('Avatar: Optimizing ' . $this->path);
ImageOptimizer::optimize($this->path);
}
}