networkteam / neos-asset-ai-classification
AI classification for assets in the classic Neos Media Browser
Package info
github.com/networkteam/Networkteam.Neos.AssetAiClassification
Type:neos-package
pkg:composer/networkteam/neos-asset-ai-classification
Requires
- php: ^8.0
- neos/fusion: ^8.3
- neos/media-browser: ^8.3
- neos/neos: ^8.3
Requires (Dev)
- mikey179/vfsstream: ~1.6
- neos/buildessentials: ~8.3.0
- phpunit/phpunit: ~9.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
AI classification for local Neos Media assets in Neos Media Browser.
An asset is classified as Without AI, AI generated or AI modified. The classification is exclusive and belongs to the asset, so all uses and cropped image variants share it.
Installation
composer require networkteam/neos-asset-ai-classification ./flow doctrine:migrate ./flow flow:cache:flush
The migration covers the Doctrine MySQL 5.7 and MySQL 8 platforms, other database platforms need their own.
Usage
Fusion:
aiClassification = ${AssetAiClassification.getClassification(q(node).property('image'))}
aiGenerated = ${AssetAiClassification.isAiGenerated(q(node).property('image'))}
aiModified = ${AssetAiClassification.isAiModified(q(node).property('image'))}
Fluid:
{namespace ai=Networkteam\Neos\AssetAiClassification\ViewHelpers}
<ai:classification asset="{asset}" />
PHP, via Domain\Service\AssetAiClassificationService:
$service->getClassification($asset); // 'none' | 'generated' | 'modified' $service->setClassification($asset, AssetAiClassification::AI_GENERATED);
All read methods accept an asset, an image variant or null. Writing emits Neos Media's assetUpdated signal,
pass false as third argument to suppress it.
Supporting a new Neos version
Resources/Private/Templates/Asset/Edit.html is a copy of the Media Browser template and differs from it by a
single f:render line. Diff it against the upstream template of the new Neos version and re-apply that line.
That copy is what ties the package to a Neos version, not the PHP code — the neos/* constraints in
composer.json have to match the Neos version the template was copied from.