mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
35 lines
933 B
PHP
35 lines
933 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Intervention\Image\Facades\Image;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class ProcessPosterImage implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public $concert;
|
|
|
|
public function __construct($concert)
|
|
{
|
|
$this->concert = $concert;
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$imageContents = Storage::disk('public')->get($this->concert->poster_image_path);
|
|
|
|
$image = Image::make($imageContents)->resize(600, null, function ($constraint) {
|
|
$constraint->aspectRatio();
|
|
})->limitColors(255)->encode();
|
|
|
|
Storage::disk('public')->put($this->concert->poster_image_path, (string) $image);
|
|
}
|
|
}
|