kuvia/app/Jobs/ResizeImage.php

50 lines
1.1 KiB
PHP
Raw Normal View History

2021-01-17 02:09:02 +00:00
<?php
namespace App\Jobs;
2021-01-20 18:51:12 +00:00
use Ajaxray\PHPWatermark\Watermark;
2021-01-17 02:09:02 +00:00
use App\Models\Access;
use App\Models\Gallery;
use App\Models\Image;
use App\Models\Tenant;
use Gumlet\ImageResize;
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 Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
2021-01-20 18:51:12 +00:00
use Intervention\Image\ImageManager;
2021-01-17 02:09:02 +00:00
class ResizeImage implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $image_id;
private $size;
/**
* Create a new job instance.
*
* @return void
*/
2021-01-17 02:13:59 +00:00
public function __construct(int $image_id, int $size)
2021-01-17 02:09:02 +00:00
{
$this->image_id = $image_id;
$this->size = $size;
}
/**
* Execute the job.
*
* @return void
*/
2021-01-21 00:13:41 +00:00
public function handle(\App\Helper\Image $imageHelper)
2021-01-17 02:09:02 +00:00
{
2021-01-21 00:13:41 +00:00
$imageHelper->getImageById($this->image_id, $this->size);
2021-01-17 02:09:02 +00:00
}
}