2021-09-06 02:31:27 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Aweos\Resizer\Classes;
|
|
|
|
|
2021-09-09 19:18:41 +02:00
|
|
|
use Aweos\Resizer\Lib\MediaPath;
|
2021-10-30 21:45:12 +02:00
|
|
|
use Log;
|
|
|
|
use Throwable;
|
2021-09-09 19:18:41 +02:00
|
|
|
|
2021-09-06 02:31:27 +02:00
|
|
|
class ResizeJob
|
|
|
|
{
|
|
|
|
|
|
|
|
public function fire($job, $params)
|
|
|
|
{
|
2021-10-30 23:07:50 +02:00
|
|
|
try {
|
|
|
|
list($file) = $params;
|
2021-10-31 23:58:16 +01:00
|
|
|
app(ImageResizer::class)->generate(new MediaPath($file), $params['update'] ?? false);
|
2021-10-30 23:07:50 +02:00
|
|
|
} catch (Throwable $e) {
|
|
|
|
Log::error('Resizing of image failed. Message: "'.$e->getMessage().'" in file "'.$e->getFile().'" on line '.$e->getLine());
|
|
|
|
throw $e;
|
|
|
|
}
|
2021-09-06 02:31:27 +02:00
|
|
|
}
|
2021-10-30 21:45:12 +02:00
|
|
|
|
|
|
|
public function failed($data, Throwable $e)
|
|
|
|
{
|
|
|
|
Log::error("Resizing of image failed", [
|
|
|
|
'message' => $e->getMessage(),
|
|
|
|
'exception' => $e,
|
|
|
|
'data' => $data,
|
|
|
|
]);
|
|
|
|
|
|
|
|
throw $e;
|
|
|
|
}
|
2021-09-06 02:31:27 +02:00
|
|
|
}
|