Skip to content

Conversation

nkt
Copy link

@nkt nkt commented Jul 6, 2014

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

In my current project I've added validation rule, that image aspect ratio should be equal 1.33. But php gives more precision if calculate 4/3. So I have to add hack: minRatio="1.332", maxRatio="1.334".
This PR allow specify precision for image aspect ratio, using ratioPrecision option.

@webmozart
Copy link
Contributor

Thank you for this PR! I'm not sure this is necessary. Wouldn't it suffice to fix the precision to 2 or 3 digits?

@nkt
Copy link
Author

nkt commented Jul 18, 2014

@webmozart do you mean always round ratio?

@fabpot
Copy link
Member

fabpot commented Aug 28, 2014

@nkt Instead of adding yet another option, what about being less strict when checking the precision? If you set the ratio to 1.33, we would only check the first X digits, so 4/3 == 1.33333, but the comparison would be on 1.33 and would match your ratio.

@webmozart
Copy link
Contributor

Replaced by #11928.

@webmozart webmozart closed this Sep 15, 2014
@nkt nkt deleted the image-validator-ratio-precision branch September 15, 2014 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants