Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
FEATURE: Batch rendering of asset variants #2751
This provides the following functionality:
The feature comes with no configurable settings itself. But you will need to configure asset
Neos: Media: variantPresets: 'AcmeCom:Square': label: 'AcmeCom Square Preset' mediaTypePatterns: ['~image/.*~'] variants: 'square': label: 'Square' adjustments: 'crop': type: 'Neos\Media\Domain\Model\Adjustment\CropImageAdjustment' options: aspectRatio: '1:1'
See the variant presets documentation at https://neos-media.readthedocs.io/en/stable/VariantPresets.html for details.
Simply run the command:
This adds a createVariant() method in addition to the existing createVariants() method. Furthermore it prepares the AssetVariantGenerator into the direction of variants other than ImageVariant by making the code more generic in naming and types used.
So far ImageVariant was filtered explicitly in various places in AssetRepository. This makes filtering work against any implementation of AssetVariantInterface instead.
bwaidelich left a comment
I'm not a big fan of big controllers even if they are command controllers, but well.. it's not the first one and definitely not a reason to block this.
But I have to admit that I failed to actually test this since I can't find any documentation about asset presets out there o.O
btw: Sorry if my first "review" seemed negative, it wasn't meant to. I'm just a bit puzzled that such a great feature isn't really exposed to the "outside" due to missing docs. But that's not related to this change of course.
@kdambekalns Thanks a lot for the update, the example and the link to the neos media documentation (which I wasn't aware of.. o.O)
When following the example I ran into 2 errors, but they are not directly related I think:
Apparently Variant Presets need a label – I adjusted your config snippet accordingly
I had a node of that type in my demo site installation, maybe due to some old db state. After removing that, it works as expected.