/home/techb158/immovalet.com/platform/core/media/src/Commands
Edit: /home/techb158/immovalet.com/platform/core/media/src/Commands/GenerateThumbnailCommand.php (1914B)
fileRepository = $fileRepository;
}
/**
* @return int
*/
public function handle()
{
$this->info('Starting to generate thumbnails...');
$files = $this->fileRepository->allBy([], [], ['url', 'mime_type']);
$this->info('Processing ' . $files->count() . ' ' . Str::plural('file', $files->count()) . '...');
$errors = [];
foreach ($files as $file) {
try {
RvMedia::generateThumbnails($file);
} catch (Exception $exception) {
$errors[] = $file->url;
$this->error($exception->getMessage());
}
}
$this->info('Generated media thumbnails successfully!');
$errors = array_unique($errors);
$errors = array_map(function ($item) {
return [$item];
}, $errors);
if ($errors) {
$this->info('We are unable to regenerate thumbnail for these files:');
$this->table(['File directory'], $errors);
return 1;
}
return 0;
}
}