Gallery image dimensions or aspect ratio

Hi all,

I’ve recently started working with Cockpit and I am using the API to serve a gallery of images to the frontend. For display purposes, I’d like to return the image aspect ratio information in the image metadata.

Currently the only metadata returned by the API for an image in a gallery is “Title” and “Asset”, is it possible to extend this to allow for the user to to enter the aspect ratio when uploading - or if there was someway to have cockpit run a script on upload to calculate this?

I am also strongly looking for a solution for this!

If you’re using imageStyles plugin, you can extract dimensions from one of your resized image URL and then calculate native aspect ratio with a bit of javascript. That’s what I actually did to get around this problem :wink: