title: PHP Prevent Remote Image from downloading over 5mb while checking for Width and Height
body: <p>I need to know how to limit PHP from downloading a file more than 5mb returning an error if it does. But if it passes I want it to check for the width and height. But I don't want it to download the file again to check for the width and height. Here is my current code:</p>
  
  <p><code>&lt;?php
  list($width, $height) = getimagesize('http://www.spacetelescope.org/static/archives/images/large/heic0601a.jpg');
  echo $width.' x '.$height;</code></p>
  
  <p>thanks.</p>