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

core(image-aspect-ratio): loosen ratio check #5358

Merged
merged 3 commits into from
May 29, 2018
Merged

Conversation

patrickhulce
Copy link
Collaborator

Related Issues/PRs
closes #5356

const doRatiosMatch = Math.abs(actualAspectRatio - displayedAspectRatio) < THRESHOLD;

const targetDisplayHeight = image.width / actualAspectRatio;
const doRatiosMatch = Math.abs(actualAspectRatio - displayedAspectRatio) < THRESHOLD_PERCENT ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there value in maintaining the ratio difference check, then? It seems like it would either be less lenient than the pixel check or the images would be big enough that they would have the flexibility to change the image size to get under the limit.

I haven't completely worked out the problem, though, so I may be missing cases :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a quick check with this branch shows that dropping it for the pixel check would still pass all our tests, at least :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sgtm, let's just go with targetDisplayHeight

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@patrickhulce patrickhulce merged commit af71277 into master May 29, 2018
@patrickhulce patrickhulce deleted the image_aspect_loose branch May 29, 2018 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image aspect ratio audit is too strict
2 participants