title: How to fix error with Unsupported image type on Image::make
body: <p>I'm trying to create images/user_avatars with Laravel Nova admin panel and with api. I need generate 3 pictures for each download - avatar, thumbnail and preview. </p>
  
  <pre class="lang-php prettyprint-override"><code> public function fields(Request $request)
       {
            return [
  
         //some fields else
          Avatar::make(__('Profile Photo'), 'avatar_path')
               -&gt;path('images/users/avatars')
               -&gt;storeAs(function (Request $request){
                   $file = $request-&gt;file('avatar_path');
                   return $request-&gt;user()-&gt;id.'_'. sha1($file-&gt;getClientOriginalName()).'.'.$file-&gt;getClientOriginalExtension();
               })
              -&gt;preview(function ($value, $disk){
                   return $this-&gt;getCroppedAvatar($value, 'prev', 636);
               })
               -&gt;thumbnail(function ($value, $disk){
                   return $this-&gt;getCroppedAvatar($value, 'thumb', 64);
               })
               -&gt;disableDownload(),
  </code></pre>
  
  <p>In this field i'm using the following method</p>
  
  <pre class="lang-php prettyprint-override"><code>     public static function getCroppedAvatar($value, $type, $size)
           {
                $path = str_replace('avatars', $type , $value);
                if ($value &amp;&amp; !Storage::exists($value)) {
                    return null;
                }
                if ($value &amp;&amp; is_file(Storage::path($path)) &amp;&amp; !is_dir(Storage::path($path))) {
               return Storage::url($path);
                }
                if ($value) {
                   Image::make(Storage::path($value))
                     -&gt;widen($size)-&gt;save(Storage::path($path));
                    Log::info('New preview is ' . Storage::path($path));
                    return Storage::url($path);
                }
                return null;
            }
  </code></pre>
  
  <p>In this case Laravel Nova is working, but if I try to call getCroppedAvatar from API Controller, i have an error on Image::make line:</p>
  
  <pre><code>Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. {"userId":16,"exception":"[object] (Intervention\\Image\\Exception\\NotReadableException(code: 0): Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. at /var/www/tracker/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php:59)
  </code></pre>
  
  <p>Code on API Controller</p>
  
  <pre class="lang-php prettyprint-override"><code>    Storage::put($fileDirectory.'/'.$fileName, $image);
      User::getCroppedAvatar($fileDirectory.'/'.$fileName,'prev', 636);
      User::getCroppedAvatar($fileDirectory.'/'.$fileName,'thumb', 64);
  </code></pre>
  
  <p>In both cases i'm using png and jpg files. Argument values are the same. 
  How can i fix it?
  Thank you!</p>