6 declare(strict_types=1);
13 use Symfony\Component\Console\Input\InputInterface;
14 use Symfony\Component\Console\Output\OutputInterface;
15 use Symfony\Component\Console\Helper\ProgressBar;
33 private $objectManager;
45 parent::__construct();
46 $this->resize = $resize;
47 $this->appState = $appState;
56 $this->setName(
'catalog:images:resize')
57 ->setDescription(
'Creates resized product images');
63 protected function execute(InputInterface $input, OutputInterface
$output)
67 $generator = $this->resize->resizeFromThemes();
70 $progress = $this->objectManager->create(ProgressBar::class, [
75 "%current%/%max% [%bar%] %percent:3s%% %elapsed% %memory:6s% \t| <info>%message%</info>" 78 if (
$output->getVerbosity() !== OutputInterface::VERBOSITY_NORMAL) {
79 $progress->setOverwrite(
false);
86 }
catch (\Exception $e) {
87 $output->writeln(
"<error>{$e->getMessage()}</error>");
89 return \Magento\Framework\Console\Cli::RETURN_FAILURE;
93 $output->writeln(
"<info>Product images resized successfully</info>");