neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 218 forks source link

FEATURE: Add image helper and render image dimensions in image tag attributes #5131

Open Sebobo opened 3 weeks ago

Sebobo commented 3 weeks ago

With this change a new image helper is introduced in Neos.Media which allows creating a thumbnail and using its various properties in Fusion object. This way the actual size of a thumbnail can be rendered into the HTML attributes. Until now we only had the uri from the ImageUri helper and component.

Review instructions

Adjust the image prototype renderer in the Demo like this:

prototype(Neos.Demo:Content.Image) < prototype(Neos.Neos:ContentComponent) {
    renderer = afx`
        <figure>
            <Neos.Neos:ImageTag
                asset={q(node).property('image')}
                width={900}
                height={200}
                allowUpScaling={true}
            />
        </figure>
    `
//    renderer = afx`<Neos.Demo:Presentation.Image {...props} />`
}

The resulting image should have with and height properties of the generated thumbnail and not the ones of the original.

I'm not 100% sure if we could break something with this change if somebody modified the ImageTag prototype. We can also target 9.0 if the anybody thinks this would be better.