Skip to content

[Validator] Image: add aspect ratio #7596

Closed
@apfelbox

Description

@apfelbox

Hi,

I would propose to add an option "aspectRatio" to the Image validation component. It could the syntax aspectRatio: 0.5 or aspectRatio: "16:9".

The use case is quite obvious: one has images with a fixed aspect ratio (like square images with 200x200), but want to provide the possibility for the user to upload larger images and autoscale them down (without cropping them). The code would look like this:

Entity:
  property:
    photo:
      - Image:
        minWidth: 200
        minHeight: 200
        aspectRatio: "1:1"

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions