public function extractCommand() { $iterator = $this->assetRepository->findAllIterator(); $assetCount = $this->assetRepository->countAll(); $this->output->progressStart($assetCount); foreach ($this->assetRepository->iterate($iterator) as $asset) { /** @var \TYPO3\Media\Domain\Model\Document $asset */ try { $this->extractionManager->extractMetaData($asset); } catch (NoExtractorAvailableException $exception) { $this->output->outputLine($exception->getMessage()); } $this->output->progressAdvance(1); } $this->outputLine("\nFinished extraction."); }
/** * 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 ``TYPO3.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); } } }