oc-resizer-plugin/classes/ResizeJob.php

34 lines
764 B
PHP

<?php
namespace Aweos\Resizer\Classes;
use Aweos\Resizer\Lib\MediaPath;
use Log;
use Throwable;
class ResizeJob
{
public function fire($job, $params)
{
try {
list($file) = $params;
app(ImageResizer::class)->generate(new MediaPath($file), $params['update'] ?? false);
} catch (Throwable $e) {
Log::error('Resizing of image failed. Message: "'.$e->getMessage().'" in file "'.$e->getFile().'" on line '.$e->getLine());
throw $e;
}
}
public function failed($data, Throwable $e)
{
Log::error("Resizing of image failed", [
'message' => $e->getMessage(),
'exception' => $e,
'data' => $data,
]);
throw $e;
}
}