Created
August 22, 2017 19:58
-
-
Save juanmafla/8cb70e17e50a5b5b034406f128556953 to your computer and use it in GitHub Desktop.
Calculate proportions in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function propor($nwidth, $nheight, $mwidth, $mheight) { | |
| $percentChange = $nwidth / $mwidth; | |
| $newHeight = round( ( $percentChange *$mheight ) ); | |
| if($nheight==$newHeight ) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment