Neos\Neos\Controller\Backend\ContentController::createImageVariantAction PHP Method

createImageVariantAction() public method

Generate a new image variant from given data.
public createImageVariantAction ( ImageVariant $asset ) : string
$asset Neos\Media\Domain\Model\ImageVariant
return string
    public function createImageVariantAction(ImageVariant $asset)
    {
        if ($this->persistenceManager->isNewObject($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));
    }