title: Intervention Image cache with Laravel: works once, then "Image cannot be displayed as it contains errors"
body: <p>As per the question title, I am using the Intervention package with Laravel. I have the following code in my routes file:</p>
  
  <pre><code>Route::get('resize-image/{pathkey}/{filename}/{w?}/{h?}', function($pathkey, $filename, $w=100, $h=100){
  
      $cacheimage = Image::cache(function($image) use($pathkey, $filename, $w, $h){
  
          switch($pathkey){
              case 'tour-images':
                  $filepath = 'upload/tour-images/' . $filename;
                  break;
          }
          return $image-&gt;make($filepath)-&gt;resize($w,$h);
  
      },10,true); // cache for 10 minutes
  
      return Response::make($cacheimage, 200, array('Content-Type' =&gt; 'image/jpeg'));
  });
  </code></pre>
  
  <p>When I call an image using something like: <code>/resize-image/tour-images/139326085726.jpg/1100/400</code> it works nicely, then as soon as I reload the page, I get the error:</p>
  
  <p><em>The image xxxx cannot be displayed beacause it contains errors</em></p>
  
  <p>If I change the dimensions (so forcing it to resize the image again), it works, then.. same problem. When I reload the page, it should be the cached image that is loading this time... but it's not working. What is happening?</p>