oc-resizer-plugin/classes/ResizeJob.php

34 lines
681 B
PHP
Raw Normal View History

2021-09-06 02:31:27 +02:00
<?php
namespace Aweos\Resizer\Classes;
use Aweos\Resizer\Classes\CacheManager;
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;
$media = new MediaPath($file);
app(ImageResizer::class)->generate($media, $params['update'] ?? false);
app(CacheManager::class)->delete($media);
2021-11-28 21:53:23 +01:00
$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
}