1

I'm trying to upload an image and resize it using Intervention Image 2.x. But I get an error called Image source not readable.

Is there a way to debug this error.

enter image description here

I'm using the following code shown in the documentation.

Image::make($request->file('productImage'))->resize(800, 500)->save('foo.jpg');

And my view part responsible for file upload is,

<div class="form-group">
    <label for="inputFile" class="col-sm-2 control-label">Product Image</label>
    <div class="col-sm-10">
         <input type="file" id="productImage" name="productImage">
         <p class="help-block">Upload product Image</p>
    </div>
</div>

There are lots of resources for older version of Laravel, but it's hard to find resources for Laravel 5.4

Any suggestion is appreciated.

Isuru
  • 3,818
  • 13
  • 49
  • 64

1 Answers1

2

Make sure your form have enctype="multipart/form-data", if you use laravel collective

{{ Form::open(['url' => 'foo/bar', 'method' => 'put', 'files' => true]) }}

erashdan
  • 152
  • 1
  • 9
  • I'm not using Laravel form helper library. So I did add the enctype="multipart/form-data" tag to form element. Your answer is right. Thanks! – Isuru Jul 18 '17 at 11:21