title: PHP imagecreatefromstring(): gd-jpeg, libjpeg: recoverable error
body: <p>I'm trying to load an image from an external site over which I have no control.</p>
  
  <p>Most of the time it works fine (hundreds of images tested so far).</p>
  
  <p>It's now giving me this error for one particular image:</p>
  
  <p><strong>imagecreatefromstring(): gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: premature end of data segment</strong></p>
  
  <p>from this line:</p>
  
  <pre><code>$im = @imagecreatefromstring( $imageString );
  </code></pre>
  
  <p>The advice I'd read so far suggests adding:</p>
  
  <pre><code>ini_set("gd.jpeg_ignore_warning", true);
  </code></pre>
  
  <p>but that's had no effect and I'm still getting the error. I'm doing the ini_set just before the call. Is that relevant?</p>
  
  <p>I'm really stuck on how to ignore this error and carry on.</p>