Update ImageUpdate job, skip non gd-compatible mime types

This commit is contained in:
Daniel Supernault 2018-08-26 13:05:45 -06:00
parent c52c841eac
commit 17e099c206
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -16,6 +16,12 @@ class ImageUpdate implements ShouldQueue
protected $media;
protected $protectedMimes = [
'image/gif',
'image/bmp',
'video/mp4'
];
/**
* Create a new job instance.
*
@ -38,7 +44,7 @@ class ImageUpdate implements ShouldQueue
$thumb = storage_path('app/'. $media->thumbnail_path);
try {
ImageOptimizer::optimize($thumb);
if($media->mime !== 'image/gif')
if(!in_array($media->mime, $this->protectedMimes))
{
ImageOptimizer::optimize($path);
}