Update ImageResize job, add more logging

This commit is contained in:
Daniel Supernault 2023-12-20 23:10:57 -07:00
parent 795132df18
commit dd16189fc8
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -9,6 +9,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Log;
class ImageResize implements ShouldQueue class ImageResize implements ShouldQueue
{ {
@ -46,6 +47,7 @@ class ImageResize implements ShouldQueue
} }
$path = storage_path('app/'.$media->media_path); $path = storage_path('app/'.$media->media_path);
if (!is_file($path) || $media->skip_optimize) { if (!is_file($path) || $media->skip_optimize) {
Log::info('Tried to optimize media that does not exist or is not readable. ' . $path);
return; return;
} }
@ -57,6 +59,7 @@ class ImageResize implements ShouldQueue
$img = new Image(); $img = new Image();
$img->resizeImage($media); $img->resizeImage($media);
} catch (Exception $e) { } catch (Exception $e) {
Log::error($e);
} }
ImageThumbnail::dispatch($media)->onQueue('mmo'); ImageThumbnail::dispatch($media)->onQueue('mmo');