title: Server stops at wp_generate_attachment_metadata call
body: <p>I am using the <a href="https://wordpress.org/plugins/regenerate-thumbnails/" rel="nofollow">Regenerate Thumbnails</a> WordPress plugin, which works on smaller images but for anything that's larger then about 800K it says: </p>
  
  <pre><code>The resize request was abnormally terminated (ID 496). This is likely due to the image exceeding available memory or some other type of fatal error.
  </code></pre>
  
  <p>I have traced the error to line 372 of regenerate-thumbnails.php:</p>
  
  <pre><code>$metadata = wp_generate_attachment_metadata( $image-&gt;ID, $fullsizepath );
  </code></pre>
  
  <p>On small images this function call will return the result as it is suppose to, but on bigger images it will stop execution, resulting in an empty ajax response (the error message itself is created using JavaScript on line 285). </p>
  
  <p>It seems weird that it would be a memory error because the memory limit is 120M. So my question is why dose this function sometimes work and other times crash. And more importantly, how to fix it.</p>