convertFrom() public méthode

Convert an object from \Neos\Media\Domain\Model\ImageInterface to a json representation
public convertFrom ( Neos\Media\Domain\Model\ImageInterface $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string | Error
$source Neos\Media\Domain\Model\ImageInterface
$targetType string must be 'string'
$convertedChildProperties array
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Résultat string | Neos\Flow\Validation\Error The converted Image, a Validation Error or NULL
 /**
  * Convert an object from \Neos\Media\Domain\Model\ImageInterface to a json representation.
  *
  * @param ImageInterface $source
  * @param string $targetType must be 'string'
  * @param array $convertedChildProperties
  * @param PropertyMappingConfigurationInterface $configuration
  * @return string The converted ImageInterface
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
 {
     $data = parent::convertFrom($source, 'array', $convertedChildProperties, $configuration);
     return json_encode($data);
 }
 /**
  * Returns important meta data for the given object implementing ImageInterface.
  *
  * Will return an array with the following keys:
  *
  *   "originalImageResourceUri": Uri for the original resource
  *   "previewImageResourceUri": Uri for a preview image with reduced size
  *   "originalDimensions": Dimensions for the original image (width, height, aspectRatio)
  *   "previewDimensions": Dimensions for the preview image (width, height)
  *   "object": object properties like the __identity and __type of the object
  *
  * @param ImageInterface $image The image to retrieve meta data for
  * @return array
  */
 protected function getImageInterfacePreviewData(ImageInterface $image)
 {
     // TODO: Now that we try to support all ImageInterface implementations we should use a strategy here to get the image properties for custom implementations
     if ($image instanceof ImageVariant) {
         $imageProperties = $this->getImageVariantPreviewData($image);
     } else {
         $imageProperties = $this->getImagePreviewData($image);
     }
     $imageProperties['object'] = $this->imageInterfaceArrayPresenter->convertFrom($image, 'string');
     return $imageProperties;
 }