title: PHP Image upload limit aspect ratio and allow only images with dimensions >= 600px
body: <p>I want to restrict any images uploaded to an aspect ratio of 1. These images should also have a minimum height/width of 600px. My problem is that my javascript <code>cropper(slimimagecropper)</code> sometimes produces images with dimensions of 599x600px or 598x600px. To solve this problem I wanted to allow a <strong>tolerance of +-3px.</strong>
  I check the aspect ratio as follows:</p>
  
  <pre><code>if (abs(1 - ($image-&gt;width() / $image-&gt;height())) &lt;= 0.009) { //... }
  </code></pre>
  
  <p>But now the greater the image (for example 700x700) the greater is the tolerance (7px).</p>
  
  <p>Does someone know a better way to check for the aspect ratio?</p>