oc-resizer-plugin/classes/ResizeJob.php

30 lines
565 B
PHP
Raw Normal View History

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-11-28 21:53:23 +01:00
list($file) = $params;
app(ImageResizer::class)->generate(new MediaPath($file), $params['update'] ?? false);
$job->delete();
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
}