/** * Refreshes this asset after the Resource has been modified * * @return void */ public function refresh() { $adjustments = array(new ResizeImageAdjustment(array('maximumWidth' => $this->maximumWidth, 'maximumHeight' => $this->maximumHeight, 'ratioMode' => $this->ratioMode, 'allowUpScaling' => $this->allowUpScaling))); $processedImageInfo = $this->imageService->processImage($this->originalAsset->getResource(), $adjustments); $this->resource = $processedImageInfo['resource']; $this->width = $processedImageInfo['width']; $this->height = $processedImageInfo['height']; }
/** * @param Asset $asset * @param MetaDataCollection $metaDataCollection */ protected function buildAssetMetaData(Asset $asset, MetaDataCollection $metaDataCollection) { $tags = []; /** @var \TYPO3\Media\Domain\Model\Tag $tagObject */ foreach ($asset->getTags() as $tagObject) { $tags[] = $tagObject->getLabel(); } $collections = []; /** @var \TYPO3\Media\Domain\Model\AssetCollection $collectionObject */ foreach ($asset->getAssetCollections() as $collectionObject) { $collections[] = $collectionObject->getTitle(); } $assetDto = new Dto\Asset(['Caption' => $asset->getCaption(), 'Identifier' => $asset->getIdentifier(), 'Title' => $asset->getTitle(), 'FileName' => $asset->getResource()->getFilename(), 'Collections' => $collections, 'Tags' => $tags, 'AssetObject' => $asset]); $metaDataCollection->set('asset', $assetDto); }