[Solved] Convert-error when importing site

Hi there,

I am trying to import my site from the exportet package (./flow site:export --package-key “schnippeldischnapp”) out of the production-site into my locally served development context (./flow site:import --package-key “schni…”).

The following error occurs:

During the import of the “Sites.xml” from the package “HKWeb.Site” an exception occurred: Error: During import an exception occurred: “Could not convert target type “Neos\Media\Domain\Model\ImageVariant”: Could not convert target type “Neos\Media\Domain\Model\Adjustment\CropImageAdjustment”, at property path “aspectRatio”: No converter found which can be used to convert from “string” to "Neos\Media\Domain\ValueObject\Configuration\AspectRatio”."., see log for further information.

What shall I do now? What did I missed (missconfigure :-)).
Thanks in advance for an answer.

Best, H.

This seems to be due to the importer not recognising the aspect ratio type, a quick fix should be the following, just remember to update the namespace to match your site package. You will need to put this in ./Classes/TypeConverter/AspectRatioTypeConverter.php


namespace CAMAO\Site\TypeConverter;

use Neos\Error\Messages\Error;
use Neos\Flow\Property\Exception;
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
use Neos\Flow\Property\TypeConverter\AbstractTypeConverter;
use Neos\Flow\Property\TypeConverterInterface;
use Neos\Media\Domain\ValueObject\Configuration\AspectRatio;

class AspectRatioTypeConverter extends AbstractTypeConverter implements TypeConverterInterface
    protected $sourceTypes = ['string'];

    protected $targetType = AspectRatio::class;

    public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
        if ($source === '') {
            return null;
        return AspectRatio::fromString($source);

1 Like

Thanks for the quick-fix!

I wondered why this happen and got some spare information while searching in code and functions: could this happen due to a false database installation (are those converters stored there anywhere)? A forgotten (package/doctrine) migration? Something like this?

While wondering I stumbled over the wonderful sitegeist/magicwand package and just overwrote the “whole” local (database)-installation … worked :slight_smile:


Seen this Bugfix ?

BUGFIX: Fix failing site imports when using cropped images #2598

(worked for me on Neos 4.3 …)