/**
  * Shows a specific asset
  *
  * @param string $identifier Specifies the asset to look up
  * @return string
  */
 public function showAction($identifier)
 {
     $asset = $this->assetRepository->findByIdentifier($identifier);
     if ($asset === null) {
         $this->throwStatus(404);
     }
     $this->view->assign('asset', $asset);
 }
Ejemplo n.º 2
0
 /**
  * Upload a new image and return an image variant, a thumbnail and additional information like it would be
  * returned for the Neos backend.
  *
  * @param Image $image
  * @return string
  */
 public function uploadAction(Image $image)
 {
     $this->assetRepository->add($image);
     $imageVariant = new ImageVariant($image);
     $this->assetRepository->add($imageVariant);
     $thumbnail = $image->getThumbnail(100, 100);
     $this->response->setHeader('Content-Type', 'application/json');
     return json_encode(array('__identity' => $this->persistenceManager->getIdentifierByObject($image), '__resourceUri' => $this->resourceManager->getPublicPersistentResourceUri($image->getResource()), 'width' => $image->getWidth(), 'height' => $image->getHeight(), 'thumbnail' => array('__resourceUri' => $this->resourceManager->getPublicPersistentResourceUri($thumbnail->getResource()), 'width' => $thumbnail->getWidth(), 'height' => $thumbnail->getHeight()), 'variants' => array(array('__identity' => $this->persistenceManager->getIdentifierByObject($imageVariant), '__resourceUri' => $this->resourceManager->getPublicPersistentResourceUri($imageVariant->getResource()), 'width' => $imageVariant->getWidth(), 'height' => $imageVariant->getHeight()))));
 }
 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.");
 }
 /**
  * Generate a new image variant from given data.
  *
  * @param ImageVariant $asset
  * @return string
  */
 public function createImageVariantAction(ImageVariant $asset)
 {
     $this->assetRepository->add($asset);
     $propertyMappingConfiguration = new PropertyMappingConfiguration();
     // This will not be sent as "application/json" as we need the JSON string and not the single variables.
     return json_encode($this->entityToIdentityConverter->convertFrom($asset, 'array', [], $propertyMappingConfiguration));
 }
Ejemplo n.º 5
0
 /**
  * @param Asset $asset
  * @param MetaDataCollection $metaDataCollection
  */
 public function mapMetaData(Asset $asset, MetaDataCollection $metaDataCollection)
 {
     $contextVariables = array_merge($this->defaultContextVariables, $metaDataCollection->toArray());
     if (isset($this->metaDataMappingConfiguration['title'])) {
         $asset->setTitle(substr((string) EelUtility::evaluateEelExpression($this->metaDataMappingConfiguration['title'], $this->eelEvaluator, $contextVariables), 0, 255));
     }
     if (isset($this->metaDataMappingConfiguration['caption'])) {
         $asset->setCaption((string) EelUtility::evaluateEelExpression($this->metaDataMappingConfiguration['caption'], $this->eelEvaluator, $contextVariables));
     }
     if (isset($this->metaDataMappingConfiguration['tags'])) {
         $tagLabels = EelUtility::evaluateEelExpression($this->metaDataMappingConfiguration['tags'], $this->eelEvaluator, $contextVariables);
         $tagLabels = array_unique($tagLabels);
         $tags = new ArrayCollection();
         foreach ($tagLabels as $tagLabel) {
             if (trim($tagLabel) !== '') {
                 $tags->add($this->getOrCreateTag(trim($tagLabel)));
             }
         }
         $asset->setTags($tags);
     }
     if (isset($this->metaDataMappingConfiguration['collections'])) {
         $collectionTitles = EelUtility::evaluateEelExpression($this->metaDataMappingConfiguration['collections'], $this->eelEvaluator, $contextVariables);
         $collectionTitles = array_unique($collectionTitles);
         $collections = new ArrayCollection();
         foreach ($collectionTitles as $collectionTitle) {
             if (trim($collectionTitle) !== '') {
                 $collections->add($this->getOrCreateCollection(trim($collectionTitle)));
             }
         }
         $asset->setAssetCollections($collections);
     }
     if (!$this->persistenceManager->isNewObject($asset)) {
         $this->assetRepository->update($asset);
     }
 }
 /**
  * @return Asset
  * @throws \TYPO3\Flow\Resource\Exception
  */
 protected function buildAssetObject()
 {
     $resource = $this->resourceManager->importResourceFromContent('Test', 'test.txt');
     $asset = new Asset($resource);
     $this->assetRepository->add($asset);
     return $asset;
 }
Ejemplo n.º 7
0
 /**
  * Creates a user based on the given information
  *
  * The created user and account are automatically added to their respective repositories and thus be persisted.
  *
  * @param string $username The username of the user to be created.
  * @param string $password Password of the user to be created
  * @param string $firstName First name of the user to be created
  * @param string $lastName Last name of the user to be created
  * @param string $department department of the user to be created
  * @param string $photo photo of the user to be created
  * @param array $roleIdentifiers A list of role identifiers to assign
  * @param string $authenticationProviderName Name of the authentication provider to use. Example: "Typo3BackendProvider"
  * @return User The created user instance
  * @api
  */
 public function createUserPhlu($username, $password, $firstName, $lastName, $department, $photo, array $roleIdentifiers = null, $authenticationProviderName = null)
 {
     $collection = $this->assetCollectionRepository->findByCollectionName('phluCollection2')->getFirst();
     if (!$collection) {
         $collection = new \TYPO3\Media\Domain\Model\AssetCollection('phluCollection2');
         $this->assetCollectionRepository->add($collection);
         $this->persistenceManager->persistAll();
     }
     $user = new User();
     $user->setDepartment($department);
     $name = new PersonName('', $firstName, '', $lastName, '', $username);
     $user->setName($name);
     $resource = $this->resourceManager->importResource($photo);
     $image = new Image($resource);
     $image->setTitle($name->getFullName());
     $tag = $this->tagRepository->findBySearchTerm('Hauswart')->getFirst();
     if (!$tag) {
         $tag = new Tag();
         $tag->setLabel('Hauswart');
         $this->tagRepository->add($tag);
         $collection->addTag($tag);
     }
     $image->addTag($tag);
     $user->setPhoto($image);
     $this->assetRepository->add($image);
     $collection->addAsset($image);
     $this->assetCollectionRepository->update($collection);
     return $this->addUserPhlu($username, $password, $user, $roleIdentifiers, $authenticationProviderName);
 }
 /**
  * Removes unused ImageVariants after a Node property changes to a different ImageVariant.
  * This is triggered via the nodePropertyChanged event.
  *
  * Note: This method it triggered by the "nodePropertyChanged" signal, @see \TYPO3\TYPO3CR\Domain\Model\Node::emitNodePropertyChanged()
  *
  * @param NodeInterface $node the affected node
  * @param string $propertyName name of the property that has been changed/added
  * @param mixed $oldValue the property value before it was changed or NULL if the property is new
  * @param mixed $value the new property value
  * @return void
  */
 public function removeUnusedImageVariant(NodeInterface $node, $propertyName, $oldValue, $value)
 {
     if ($oldValue === $value || !$oldValue instanceof ImageVariant) {
         return;
     }
     $identifier = $this->persistenceManager->getIdentifierByObject($oldValue);
     $results = $this->nodeDataRepository->findNodesByRelatedEntities(array(ImageVariant::class => [$identifier]));
     // This case shouldn't happen as the query will usually find at least the node that triggered this call, still if there is no relation we can remove the ImageVariant.
     if ($results === []) {
         $this->assetRepository->remove($oldValue);
         return;
     }
     // If the result contains exactly the node that got a new ImageVariant assigned then we are safe to remove the asset here.
     if ($results === [$node->getNodeData()]) {
         $this->assetRepository->remove($oldValue);
     }
 }
 /**
  * Fetch an object from persistence layer.
  *
  * @param mixed $identity
  * @param string $targetType
  * @return object
  * @throws \TYPO3\Flow\Property\Exception\TargetNotFoundException
  * @throws \TYPO3\Flow\Property\Exception\InvalidSourceException
  */
 protected function fetchObjectFromPersistence($identity, $targetType)
 {
     if (is_string($identity)) {
         $object = $this->assetRepository->findByIdentifier($identity);
     } else {
         throw new \TYPO3\Flow\Property\Exception\InvalidSourceException('The identity property "' . $identity . '" is not a string.', 1415817618);
     }
     return $object;
 }
 /**
  * @param FluidView $view
  * @return void
  */
 public function initializeView(FluidView $view)
 {
     $assets = $this->tsValue('assets');
     $processedAssets = array();
     /** @var Asset $asset */
     if (is_array($assets)) {
         foreach ($assets as $asset) {
             if ($asset->getResource() === null) {
                 if ($asset instanceof Image) {
                     $processedAssets[] = $this->imageRepository->findByIdentifier($asset->getIdentifier());
                 } elseif ($asset instanceof Asset) {
                     $processedAssets[] = $this->assetRepository->findByIdentifier($asset->getIdentifier());
                 }
             } else {
                 $processedAssets[] = $asset;
             }
         }
     }
     $view->assign('assets', $processedAssets);
 }
 /**
  * Fetch an object from persistence layer.
  *
  * @param mixed $identity
  * @param string $targetType
  * @return object
  * @throws TargetNotFoundException
  * @throws InvalidSourceException
  */
 protected function fetchObjectFromPersistence($identity, $targetType)
 {
     if ($targetType === Thumbnail::class) {
         $object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
     } elseif (is_string($identity)) {
         $object = $this->assetRepository->findByIdentifier($identity);
     } else {
         throw new InvalidSourceException('The identity property "' . $identity . '" is not a string.', 1415817618);
     }
     return $object;
 }
 /**
  * Fetch an object from persistence layer.
  *
  * @param mixed $identity
  * @param string $targetType
  * @return object
  * @throws \TYPO3\Flow\Property\Exception\TargetNotFoundException
  * @throws \TYPO3\Flow\Property\Exception\InvalidSourceException
  */
 protected function fetchObjectFromPersistence($identity, $targetType)
 {
     if ($targetType === 'TYPO3\\Media\\Domain\\Model\\Thumbnail') {
         $object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
     } elseif (is_string($identity)) {
         $object = $this->assetRepository->findByIdentifier($identity);
     } else {
         throw new \TYPO3\Flow\Property\Exception\InvalidSourceException('The identity property "' . $identity . '" is not a string.', 1415817618);
     }
     return $object;
 }
 /**
  * @param Tag $tag
  * @return void
  */
 public function deleteTagAction(Tag $tag)
 {
     $taggedAssets = $this->assetRepository->findByTag($tag);
     foreach ($taggedAssets as $asset) {
         $asset->removeTag($tag);
         $this->assetRepository->update($asset);
     }
     $this->tagRepository->remove($tag);
     $this->addFlashMessage('tagHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]);
     $this->redirect('index');
 }
 /**
  * @param Tag $tag
  * @return void
  */
 public function deleteTagAction(Tag $tag)
 {
     $taggedAssets = $this->assetRepository->findByTag($tag);
     foreach ($taggedAssets as $asset) {
         $asset->removeTag($tag);
         $this->assetRepository->update($asset);
     }
     $this->tagRepository->remove($tag);
     $this->addFlashMessage(sprintf('Tag "%s" has been deleted.', $tag->getLabel()));
     $this->redirect('index');
 }
 /**
  * Return the object the URI addresses or NULL.
  *
  * @param string|Uri $uri
  * @param NodeInterface $contextNode
  * @return NodeInterface|AssetInterface|NULL
  */
 public function convertUriToObject($uri, NodeInterface $contextNode = null)
 {
     if ($uri instanceof Uri) {
         $uri = (string) $uri;
     }
     if (preg_match(self::PATTERN_SUPPORTED_URIS, $uri, $matches) === 1) {
         switch ($matches[1]) {
             case 'node':
                 if ($contextNode === null) {
                     throw new \RuntimeException('node:// URI conversion requires a context node to be passed', 1409734235);
                 }
                 return $contextNode->getContext()->getNodeByIdentifier($matches[2]);
             case 'asset':
                 return $this->assetRepository->findByIdentifier($matches[2]);
         }
     }
     return null;
 }
 /**
  * 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);
         }
     }
 }
    /**
     * Import resources to asset management
     *
     * This command detects Flow "Resource" objects which are not yet available as "Asset" objects and thus don't appear
     * in the asset management. The type of the imported asset is determined by the file extension provided by the
     * Resource object.
     *
     * @param boolean $simulate If set, this command will only tell what it would do instead of doing it right away
     * @return void
     */
    public function importResourcesCommand($simulate = false)
    {
        $this->initializeConnection();
        $sql = '
			SELECT
				r.persistence_object_identifier, r.filename, r.mediatype
			FROM typo3_flow_resource_resource r
			LEFT JOIN typo3_media_domain_model_asset a
			ON a.resource = r.persistence_object_identifier
			LEFT JOIN typo3_media_domain_model_thumbnail t
			ON t.resource = r.persistence_object_identifier
			WHERE a.persistence_object_identifier IS NULL AND t.persistence_object_identifier IS NULL
		';
        $statement = $this->dbalConnection->prepare($sql);
        $statement->execute();
        $resourceInfos = $statement->fetchAll();
        if ($resourceInfos === array()) {
            $this->outputLine('Found no resources which need to be imported.');
            $this->quit();
        }
        foreach ($resourceInfos as $resourceInfo) {
            $mediaType = $resourceInfo['mediatype'];
            if (substr($mediaType, 0, 6) === 'image/') {
                $resource = $this->persistenceManager->getObjectByIdentifier($resourceInfo['persistence_object_identifier'], 'TYPO3\\Flow\\Resource\\Resource');
                if ($resource === null) {
                    $this->outputLine('Warning: Resource for file "%s" seems to be corrupt. No resource object with identifier %s could be retrieved from the Persistence Manager.', array($resourceInfo['filename'], $resourceInfo['persistence_object_identifier']));
                    continue;
                }
                if (!$resource->getStream()) {
                    $this->outputLine('Warning: Resource for file "%s" seems to be corrupt. The actual data of resource %s could not be found in the resource storage.', array($resourceInfo['filename'], $resourceInfo['persistence_object_identifier']));
                    continue;
                }
                $image = new Image($resource);
                if ($simulate) {
                    $this->outputLine('Simulate: Adding new image "%s" (%sx%s px)', array($image->getResource()->getFilename(), $image->getWidth(), $image->getHeight()));
                } else {
                    $this->assetRepository->add($image);
                    $this->outputLine('Adding new image "%s" (%sx%s px)', array($image->getResource()->getFilename(), $image->getWidth(), $image->getHeight()));
                }
            }
        }
    }
 /**
  * Converts the given $objectXml to an AssetInterface instance and returns it
  *
  * @param \SimpleXMLElement $objectXml
  * @param string $className the concrete class name of the AssetInterface to create
  * @return AssetInterface
  * @throws NeosException
  */
 protected function importAsset(\SimpleXMLElement $objectXml, $className)
 {
     if (isset($objectXml['__identifier'])) {
         $asset = $this->assetRepository->findByIdentifier((string) $objectXml['__identifier']);
         if (is_object($asset)) {
             return $asset;
         }
     }
     $resourceHash = (string) $objectXml->resource->hash;
     $resourceData = trim((string) $objectXml->resource->content);
     if ((string) $objectXml->resource['__identifier'] !== '') {
         $resource = $this->persistenceManager->getObjectByIdentifier((string) $objectXml->resource['__identifier'], 'TYPO3\\Flow\\Resource\\Resource');
     }
     if (!isset($resource) || $resource === null) {
         $resource = $this->importResource((string) $objectXml->resource->filename, $resourceHash !== '' ? $resourceHash : null, !empty($resourceData) ? $resourceData : null, (string) $objectXml->resource['__identifier'] !== '' ? (string) $objectXml->resource['__identifier'] : null);
     }
     $asset = $this->objectManager->get($className);
     $asset->setResource($resource);
     $this->assetRepository->add($asset);
     return $asset;
 }
 /**
  * @test
  */
 public function findBySearchTermAndTagsReturnsFilteredResult()
 {
     $tag = new Tag('home');
     $this->tagRepository->add($tag);
     $resource1 = $this->resourceManager->importResource(__DIR__ . '/../../Fixtures/Resources/license.txt');
     $resource2 = $this->resourceManager->importResource(__DIR__ . '/../../Fixtures/Resources/417px-Mihaly_Csikszentmihalyi.jpg');
     $asset1 = new Asset($resource1);
     $asset1->setTitle('asset for homepage');
     $asset2 = new Asset($resource2);
     $asset2->setTitle('just another asset');
     $asset2->addTag($tag);
     $this->assetRepository->add($asset1);
     $this->assetRepository->add($asset2);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $this->assertCount(2, $this->assetRepository->findBySearchTermOrTags('home', array($tag)));
     $this->assertCount(2, $this->assetRepository->findBySearchTermOrTags('homepage', array($tag)));
     $this->assertCount(1, $this->assetRepository->findBySearchTermOrTags('baz', array($tag)));
     // This is necessary to initialize all resource instances before the tables are deleted
     foreach ($this->assetRepository->findAll() as $asset) {
         $asset->getResource()->getSha1();
     }
 }
Ejemplo n.º 20
0
 /**
  * Updates the given news object
  *
  * @param \Lelesys\Plugin\News\Domain\Model\News $news The news to update
  * @param array $media  News media
  * @param array $file News file
  * @param array $tags News tags
  * @param array $relatedLink News related links
  * @return void
  */
 public function update(\Lelesys\Plugin\News\Domain\Model\News $news, $media, $file, $relatedLink, $tags)
 {
     if (!empty($tags['title'])) {
         $tagsArray = array_unique(\TYPO3\Flow\Utility\Arrays::trimExplode(',', strtolower($tags['title'])));
         foreach ($tagsArray as $tag) {
             $existTag = $this->tagService->findTagByName($tag);
             if (!empty($existTag)) {
                 $newsTags = $news->getTags()->toArray();
                 if (!in_array($existTag, $newsTags)) {
                     $news->addTags($existTag);
                 }
             } else {
                 $newTag = new \Lelesys\Plugin\News\Domain\Model\Tag();
                 $newTag->setTitle($tag);
                 $this->tagService->create($newTag);
                 $news->addTags($newTag);
             }
         }
     }
     $news->setUpdatedDate(new \DateTime());
     $mediaPath = $media;
     foreach ($mediaPath as $mediaSource) {
         if (!empty($mediaSource['uuid'])) {
             $updateAsset = $this->propertyMapper->convert($mediaSource['uuid']['__identity'], '\\TYPO3\\Media\\Domain\\Model\\Image');
             $updateAsset->setCaption($mediaSource['caption']);
             $this->imageRepository->update($updateAsset);
         } else {
             if (!empty($mediaSource['resource']['name'])) {
                 $resource = $this->propertyMapper->convert($mediaSource['resource'], 'TYPO3\\Flow\\Resource\\Resource');
                 $media = new \TYPO3\Media\Domain\Model\Image($resource);
                 $media->setCaption($mediaSource['caption']);
                 $this->imageRepository->add($media);
                 $news->addAssets($media);
             }
         }
     }
     $filePath = $file;
     foreach ($filePath as $fileSource) {
         if (isset($fileSource['uuid'])) {
             $updateFile = $this->propertyMapper->convert($fileSource['uuid']['__identity'], '\\TYPO3\\Media\\Domain\\Model\\Document');
             $updateFile->setTitle($fileSource['title']);
             $this->assetRepository->update($updateFile);
         } else {
             if (!empty($fileSource['resource']['name'])) {
                 $resource = $this->propertyMapper->convert($fileSource['resource'], 'TYPO3\\Flow\\Resource\\Resource');
                 $file = new \TYPO3\Media\Domain\Model\Document($resource);
                 $file->setTitle($fileSource['title']);
                 $this->assetRepository->add($file);
                 $news->addFiles($file);
             }
         }
     }
     $related = $relatedLink;
     foreach ($related as $link) {
         if (isset($link['uuid'])) {
             $updateLink = $this->linkService->findById($link['uuid']);
             $updateLink->setUri($link['relatedUri']);
             $updateLink->setTitle($link['relatedUriTitle']);
             $updateLink->setDescription($link['relatedUriDescription']);
             $updateLink->setHidden($link['hidden']);
             $this->linkService->update($updateLink);
         } else {
             if (!empty($link['relatedUri'])) {
                 $newLink = new \Lelesys\Plugin\News\Domain\Model\Link();
                 $newLink->setTitle($link['relatedUriTitle']);
                 $newLink->setUri($link['relatedUri']);
                 $newLink->setDescription($link['relatedUriDescription']);
                 $newLink->setHidden($link['hidden']);
                 $this->linkService->create($newLink);
                 $news->addRelatedLinks($newLink);
             }
         }
     }
     $this->newsRepository->update($news);
     $this->emitNewsUpdated($news);
 }
 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return void
  */
 public function execute(NodeData $node)
 {
     foreach ($node->getNodeType()->getProperties() as $propertyName => $propertyConfiguration) {
         if (isset($propertyConfiguration['type']) && ($propertyConfiguration['type'] === 'TYPO3\\Media\\Domain\\Model\\ImageInterface' || preg_match('/array\\<.*\\>/', $propertyConfiguration['type']))) {
             if (!isset($nodeProperties)) {
                 $nodeRecordQuery = $this->entityManager->getConnection()->prepare('SELECT properties FROM typo3_typo3cr_domain_model_nodedata WHERE persistence_object_identifier=?');
                 $nodeRecordQuery->execute([$this->persistenceManager->getIdentifierByObject($node)]);
                 $nodeRecord = $nodeRecordQuery->fetch(\PDO::FETCH_ASSOC);
                 $nodeProperties = unserialize($nodeRecord['properties']);
             }
             if (!isset($nodeProperties[$propertyName]) || empty($nodeProperties[$propertyName])) {
                 continue;
             }
             if ($propertyConfiguration['type'] === 'TYPO3\\Media\\Domain\\Model\\ImageInterface') {
                 $adjustments = array();
                 $oldVariantConfiguration = $nodeProperties[$propertyName];
                 if (is_array($oldVariantConfiguration)) {
                     foreach ($oldVariantConfiguration as $variantPropertyName => $property) {
                         switch (substr($variantPropertyName, 3)) {
                             case 'originalImage':
                                 /**
                                  * @var $originalAsset \TYPO3\Media\Domain\Model\Image
                                  */
                                 $originalAsset = $this->assetRepository->findByIdentifier($this->persistenceManager->getIdentifierByObject($property));
                                 break;
                             case 'processingInstructions':
                                 $adjustments = $this->processingInstructionsConverter->convertFrom($property, 'array');
                                 break;
                         }
                     }
                     $nodeProperties[$propertyName] = NULL;
                     if (isset($originalAsset)) {
                         $stream = $originalAsset->getResource()->getStream();
                         if ($stream === FALSE) {
                             continue;
                         }
                         fclose($stream);
                         $newImageVariant = new \TYPO3\Media\Domain\Model\ImageVariant($originalAsset);
                         foreach ($adjustments as $adjustment) {
                             $newImageVariant->addAdjustment($adjustment);
                         }
                         $originalAsset->addVariant($newImageVariant);
                         $this->assetRepository->update($originalAsset);
                         $nodeProperties[$propertyName] = $this->persistenceManager->getIdentifierByObject($newImageVariant);
                     }
                 }
             } elseif (preg_match('/array\\<.*\\>/', $propertyConfiguration['type'])) {
                 if (is_array($nodeProperties[$propertyName])) {
                     $convertedValue = [];
                     foreach ($nodeProperties[$propertyName] as $entryValue) {
                         if (!is_object($entryValue)) {
                             continue;
                         }
                         $stream = $entryValue->getResource()->getStream();
                         if ($stream === FALSE) {
                             continue;
                         }
                         fclose($stream);
                         $existingObjectIdentifier = NULL;
                         try {
                             $existingObjectIdentifier = $this->persistenceManager->getIdentifierByObject($entryValue);
                             if ($existingObjectIdentifier !== NULL) {
                                 $convertedValue[] = $existingObjectIdentifier;
                             }
                         } catch (\Exception $exception) {
                         }
                     }
                     $nodeProperties[$propertyName] = $convertedValue;
                 }
             }
         }
     }
     if (isset($nodeProperties)) {
         $nodeUpdateQuery = $this->entityManager->getConnection()->prepare('UPDATE typo3_typo3cr_domain_model_nodedata SET properties=? WHERE persistence_object_identifier=?');
         $nodeUpdateQuery->execute([serialize($nodeProperties), $this->persistenceManager->getIdentifierByObject($node)]);
     }
 }