34 lines
681 B
PHP
34 lines
681 B
PHP
<?php
|
|
|
|
namespace Aweos\Resizer\Classes;
|
|
|
|
use Aweos\Resizer\Classes\CacheManager;
|
|
use Aweos\Resizer\Lib\MediaPath;
|
|
use Log;
|
|
use Throwable;
|
|
|
|
class ResizeJob
|
|
{
|
|
|
|
public function fire($job, $params)
|
|
{
|
|
list($file) = $params;
|
|
$media = new MediaPath($file);
|
|
app(ImageResizer::class)->generate($media, $params['update'] ?? false);
|
|
app(CacheManager::class)->delete($media);
|
|
|
|
$job->delete();
|
|
}
|
|
|
|
public function failed($data, Throwable $e)
|
|
{
|
|
Log::error("Resizing of image failed", [
|
|
'message' => $e->getMessage(),
|
|
'exception' => $e,
|
|
'data' => $data,
|
|
]);
|
|
|
|
throw $e;
|
|
}
|
|
}
|