146 - Optimizing the Image Size

This commit is contained in:
Adam Wathan
2017-11-14 17:17:14 -05:00
parent 9a70efd473
commit 3b47ce0477
4 changed files with 33 additions and 3 deletions

View File

@@ -24,8 +24,11 @@ class ProcessPosterImage implements ShouldQueue
public function handle()
{
$imageContents = Storage::disk('public')->get($this->concert->poster_image_path);
$image = Image::make($imageContents);
$image->resize(600)->encode();
$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);
}
}