Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Feat: Support SVGs when validating image dimensions #45269

Copy link
Copy link
Closed
@silverbackdan

Description

@silverbackdan
Issue body actions

Description

If any image dimension validation is added with Image validation, it will fail with SVGs as the image size is detected using getimagesize. See: https://github.com/symfony/validator/blob/5.4/Constraints/ImageValidator.php#L56

Would there be a want from the community if I were to create a PR to detect SVG images and grab the file size from the XML? With this, we could skip the width/height validation all together, but still be able to implement features such as portrait/landscape/ratio validation.

I guess with the mime type, I could work out that it is an SVG, parse the content, and skip the width/size validation (it shouldn't matter with SVGs really.. or I could add an option?) I could implement other dimension validation still and return the same error if we still cannot detect the image size.

Example

No response

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.