Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG dimensions broken after 2.2.3 #205

Closed
1 task done
R33D3M33R opened this issue Jun 18, 2024 · 2 comments
Closed
1 task done

SVG dimensions broken after 2.2.3 #205

R33D3M33R opened this issue Jun 18, 2024 · 2 comments
Labels
help wanted Extra attention is needed type:bug Something isn't working.

Comments

@R33D3M33R
Copy link

Describe the bug

Dear developers,

after the 2.2.3 version, the dimensions of images are broken. The plugin doesn't seem to detect svg width, height, viewbox dimensions properly anymore, and instead pulls values from the actual drawing (path). This breaks layouts, because for example width and height for a svg image set that was dimensioned using padding are now wrong.

Please look into this as this might affect a lot of people.

Best regards,
Andrej

Steps to Reproduce

Example: SVG with gets detected as "Dimensions: 46 by 50 pixels", because that is the size of the path inside it. See example for more info:

broken-icon

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@R33D3M33R R33D3M33R added the type:bug Something isn't working. label Jun 18, 2024
@jeffpaul jeffpaul moved this to To Do in Open Source Practice Jun 18, 2024
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Jun 18, 2024
@Sidsector9 Sidsector9 self-assigned this Jun 19, 2024
@TylerB24890
Copy link
Contributor

I've tested this on a local environment and have not been able to reproduce. The supplied SVG file in the issue description is protected and cannot be downloaded, but I've tried against 5 different SVGs from different sources with no luck. width and height attributes are extracted from the viewBox attribute and are correct as far as I can see.

If there is an SVG that should be tested specifically, please provide it for reference.

@R33D3M33R
Copy link
Author

Hello,

I have tested this on a brand new site and behavior was indeed correct. So I analyzed the problematic sites and discovered:
2.2.2 probably reads info directly from the file (because the dimensions are not rounded to whole pixels)
2.2.3+ reads info from metadata which had incorrect dimensions

Since files were uploaded years ago, its impossible to know why the dimensions in database were incorrect. The simplest solution was using wp media regenerate on problematic files and now the newest version works flawlessly.

Best regards,
Andrej

@github-project-automation github-project-automation bot moved this from To Do to Done in Open Source Practice Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:bug Something isn't working.
Projects
Archived in project
Development

No branches or pull requests

4 participants