<?php

namespace App\Jobs;

use Ajaxray\PHPWatermark\Watermark;
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;
use Intervention\Image\ImageManager;

class ResizeImage implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    private $image_id;
    private $size;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(int $image_id, int $size)
    {
        $this->image_id = $image_id;
        $this->size = $size;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(\App\Helper\Image $imageHelper)
    {
        $imageHelper->getImageById($this->image_id, $this->size);
    }
}
