title: imagecreatefromjpeg return 500 internal server error issue
body: <p>I have some code that adds some headers to an image:</p>
  
  <p>Contents of file</p>
  
  <pre><code>&lt;?php
  $im = imagecreatefromjpeg($filepath);//full path
  imagejpeg($im);
  imagedestroy($im);
  ?&gt;
  </code></pre>
  
  <p>This imagecreatefromjpeg function is giving internal server error when image is big. otherwise working</p>
  
  <p>so i tried to increase memory limit</p>
  
  <pre><code>ini_set('memory_limit', '1024M'); // or you could use 1G
  </code></pre>
  
  <p>but same problem. Any solution? Thanks</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Error is </p>
  
  <pre><code>Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 51024 bytes)
  </code></pre>
  
  <p><strong>Image Dimensions:</strong></p>
  
  <p><strong>Width</strong>: 12756 px</p>
  
  <p><strong>Height</strong>: 22677 px</p>
  
  <p><strong>Size</strong>: 11.6 MB</p>