/
home
/
obinna
/
html
/
cravings
/
app
/
Jobs
/
Upload File
HOME
<?php namespace App\Jobs; use App\Http\Services\ImageManager; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Str; class ProcessReviewImage implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $url; protected $imageUrl; /** * Create a new job instance. * * @return void */ public function __construct(string $url, string $imageUrl) { $this->url = $url; $this->imageUrl = $imageUrl; } /** * Execute the job. * * @return void */ public function handle(ImageManager $im) { // process uploaded image $im = new ImageManager(); $source = $im->fromUrl($this->url); $base_image = $this->imageUrl; $path = env('S3_BUCKET') . $base_image; $credentials = array( "service" => "s3", "aws_access_key_id" => env('S3_KEY'), "aws_secret_access_key" => env('S3_SECRET'), "region" => env('S3_REGION'), "path" => $path ); $resized = $source->resize(array( "method" => "cover", "width" => 700, "height" => 700 )); $resized->store($credentials); // sleep(20); } }