Skip to content

Store dimensions of image #165

@flyingL123

Description

@flyingL123

It would be great if there was a way to store the actual dimensions of each image style in the database. Maybe we can add a column called {attachment_name}_dimensions, and save a serialized array representing the physical sizes for each style, for example:

['zoom' => ['width' => 1280, 'height' => 1000], 'thumbnail' => ['width' => 100, 'height' => 63]]

The image dimensions are required to use the great photoswipe.js library. I managed to implement this myself in a project using a very less-than-ideal workaround involving a direct database right of the dimensions inside the closure defining the style. I was unable to find a better way since there are no events that fire during the image processing process, which means there was no way to hook into it and store the dimensions.

It would be really great to have the library store these dimensions automatically by default.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions