title: ErrorException: imagecreatetruecolor(): Invalid image dimensions in file while Intervention\Image\Image::resize()
body: <p>I'm working on Laravel project and I need resize image and return it from controller as file. If image has width or height parameter equals 0, I have to compute another parameter.
  I tried it like this (as I found it in documentation of library <a href="http://image.intervention.io/api/resize" rel="nofollow noreferrer">http://image.intervention.io/api/resize</a>):</p>
  
  <pre><code>public function viewImage($w, $h, $path){
      $image = Image::where('path', $path)-&gt;first();
      if($image){
          $manager = new ImageManager(array('driver' =&gt; 'gd'));
          if ($w === 0){
              $img = $manager-&gt;make(asset("storage/galleries/".$image-&gt;fullpath))
                  -&gt;resize($w, $h, function ($constraint) {
                      $constraint-&gt;aspectRatio();
                  });
              return $img-&gt;response('jpg');
          }
          else{
              if ($h === 0){
                  $img = $manager-&gt;make(asset("storage/galleries/".$image-&gt;fullpath))
                      -&gt;resize($w, $h, function ($constraint) {
                          $constraint-&gt;aspectRatio();
                      });
                  return $img-&gt;response('jpg');
              }
              $img = $manager-&gt;make(asset("storage/galleries/".$image-&gt;fullpath))-&gt;resize($w, $h);
              return $img-&gt;response('jpg');
          }
      }
  ...
  </code></pre>
  
  <p>But it gives me error like this:</p>
  
  <pre><code>ErrorException: imagecreatetruecolor(): Invalid image dimensions in file C:\xampp\htdocs\PROGRAMATOR.SK_API\vendor\intervention\image\src\Intervention\Image\Gd\Commands\ResizeCommand.php on line 47
  </code></pre>
  
  <p>I use Intervention\Image\Image library</p>
  
  <p>Could you help me please?</p>