/** * Create thumbnails * * Creates thumbnail images based on the configured thumbnail presets. Optional ``preset`` parameter to only create * thumbnails for a specific thumbnail preset configuration. * * Additionally accepts a ``async`` parameter determining if the created thumbnails are generated when created. * * @param string $preset Preset name, if not provided thumbnails are created for all presets * @param boolean $async Asynchronous generation, if not provided the setting ``Neos.Media.asyncThumbnails`` is used * @return void */ public function createThumbnailsCommand($preset = null, $async = null) { $async = $async !== null ? $async : $this->asyncThumbnails; $presets = $preset !== null ? [$preset] : array_keys($this->thumbnailService->getPresets()); $presetThumbnailConfigurations = []; foreach ($presets as $preset) { $presetThumbnailConfigurations[] = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async); } $iterator = $this->assetRepository->findAllIterator(); $imageCount = $this->assetRepository->countAll(); $this->output->progressStart($imageCount * count($presetThumbnailConfigurations)); foreach ($this->assetRepository->iterate($iterator) as $image) { foreach ($presetThumbnailConfigurations as $presetThumbnailConfiguration) { $this->thumbnailService->getThumbnail($image, $presetThumbnailConfiguration); $this->persistenceManager->persistAll(); $this->output->progressAdvance(1); } } }