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

Aspect ratio is in an unexpected form #247

Closed
tremby opened this issue Jan 5, 2024 · 2 comments
Closed

Aspect ratio is in an unexpected form #247

tremby opened this issue Jan 5, 2024 · 2 comments
Labels

Comments

@tremby
Copy link

tremby commented Jan 5, 2024

Bug Description

I'm seeing aspect ratio come back is 56.25 for 16:9 content, which suggests it's calculated by taking the height as a percentage of the width. But aspect ratio is the ratio of width to height, not height to width. I'd expect it to be given either as an exact fraction like "16/9" or "16:9" or [16, 9], or as a decimal number like 1.777778.

I realize changing it would be breaking, but I know most developers will be surprised to see it come back as 100 * height / width, so maybe it's something to consider for a future major release.

Steps to reproduce

  1. Query (I'm using GQL) for an embed, and ask for its aspect ratio

Expected behaviour

Any of

  • "16/9"
  • "16:9"
  • [16, 9]
  • 1.77777778

Embedded Assets version

3.2.0

Craft CMS version

4.5.11.1

@tremby tremby added the bug label Jan 5, 2024
@ttempleton
Copy link
Contributor

56.25 is what's being returned (e.g. for a YouTube video of size 1920x1080 that I just tested) by the Embed library this plugin uses. If you believe that is incorrect, you'll need to take up the issue with them.

@ttempleton ttempleton closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
@tremby
Copy link
Author

tremby commented Jan 5, 2024

OK. Upstream it's documented as being width/height, but actually calculated as (height/width)*100. I've opened a bug report there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants