Image source not readable in Laravel 5.2 - Intervention Image

image source not readable laravel 6
laravel intervention image upload
laravel image resize
laravel image functions
image in laravel
laravel image upload package
image processing in laravel
image intervention in lumen

I have a small problem concerning the resizing process of a given image, I am trying to submit a form containing an input type -->file<-- I was able to upload a picture without resizing it, after that I decided to resize that image so I installed the Intervention Image Library using:

composer require intervention/image

then I integrated the library into my Laravel framework

Intervention\Image\ImageServiceProvider::class
'Image' => Intervention\Image\Facades\Image::class

and finally I configured it like following

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

my controller is like the following

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Image; 

class ProjectController extends Controller{

public function project(Request $request){  


    $file = Input::file('file');
    $fileName = time().'-'.$file->getClientOriginalName();

    $file -> move('uploads', $fileName);
    $img=Image::make('public/uploads/', $file->getRealPath())->resize(320, 240)->save('public/uploads/',$file->getClientOriginalName());

}
}

but instead of resizing the pic the following exception is throwed

NotReadableException in AbstractDecoder.php line 302:
Image source not readable

Shouldn't it be Image::make($file->getRealPath()) instead of Image::make('public/uploads/', $file->getRealPath())?

Image::make() doesn't seem to take two arguments, so that could be your problem.

Try this:

$file = Input::file('file');
$fileName = time() . '-' . $file->getClientOriginalName();

$file->move('uploads', $fileName);

$img = Image::make($file->getRealPath())
    ->resize(320, 240)
    ->save('public/uploads/', $file->getClientOriginalName());

Or if you want to do it without moving the file first, try this:

$file = Input::file('file');
$img = Image::make($file)
    ->resize(320, 240)
    ->save('public/uploads/', $file->getClientOriginalName());

Intervention / Image Upload Error {{ Image source not readable , Add the following parameter in your form tag: enctype="multipart/form-data". And change for this in make: $img  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

In L5.2 its not directly possible to get image from Input facade. For that we need to first store the image on server and then give path into Image facade to do operations on image.

Code goes likes this:

if ($request->hasFile('picture') ) {

        $destinationPath = public_path('uploads/user');
        $photoname = date("YmdHis");
        $file_extention = '.'.$request->file('picture')->getClientOriginalExtension();
        $photo = $photoname.$file_extention;
        $file_check = $request->file('picture')->move($destinationPath, $photo);

        $thumb_path = $destinationPath.'/thumbnail/'.$photo;

        $new_filePath =  $destinationPath.'/'.$photo;

        $assets_path = url('uploads/user/');

        $img = Image::make($assets_path.'/'.$photo)->fit(100)->save($thumb_path,40);

        $data['picture'] = $photo;           
    }

I was looking for direct solution i.e. as it was possible previously to take image directly from Input facade. If anyone of you have direct solution, show your code here and I'll reward you this bounty. Cheers.

Image intervention - Image source not readable, I want to add watermark to my images but It's throwing the error "Image source not Readable". I've used it on my local host and it  I'm trying to import images from an external server with the Intervention Image package and if the image exists and it's readable it works fine. But some images are not readable and I get this error: NotReadableException in AbstractDecoder.php line 302: Image source not readable I know that if the image doesn't exists I can't create it, but I

Uploading a file and resizing it before saving is as easy as that: (Without validation or checks)

You can directly pass an instance of UploadedFile to InterventionImage::make()

public function upload(Request $request)
{
    $file = $request->file('file');

    $filename = $file->getClientOriginalName();

    $img = \Image::make($file);
    $img->resize(320, 240)->save(public_path('uploads/'.$filename))

}

If you want to save original size and resized image:

    $img->save(public_path('uploads/'.$filename))
        ->resize(320, 240)
        ->save(public_path('uploads/thumb_'.$filename));

This was just tested on currently latest 5.2 version with is 5.2.45

[EDIT:]

If you call

$file->move();

Don't use

$file->getRealPath() 

afterwards, because this will return false after calling move()

    $filename = $file->getClientOriginalName();
    $file->move('uploads', $filename);
    dd($file->getRealPath());

[Laravel Intervention Image] Image source not readable, Hi all, I'm trying to import images from an external server with the Intervention Image NotReadableException in AbstractDecoder.php line 302: Image source not null)->take (5)->get(); foreach ($commerces as $oldCommerce) { $​commerce  I had the same problem, getting 'Image source not readable'. I could open the image in browser but not in php. So, my fix was adding file_get_contents inside Image::make(). Be aware, file_get_contents does not accept spaces so you need to replace them with %20. My final code is this;

This problem occurred when you resize the image after moving it

$file->move('uploads', $fileName);

$file->getRealPath() will return false after moving the image. You need to resize the image before the moving process. That's it ;)

$img=Image::make('public/uploads/', $file->getRealPath())->resize(320, 240)->save('public/uploads/',$file->getClientOriginalName());
$file->move('uploads', $fileName);

Image Source not Readable in Intervention Image : laravel, Image Source not Readable in Intervention Image. Help After working with Laravel for 5 years, I've shared a lot of tips on my blog/Twitter/Youtube.Back in  Intervention Image is an open source PHP image handling and manipulation library. It provides an easier and expressive way to create, edit, and compose images and supports currently the two most common image processing libraries GD Library and Imagick. The class is written to make PHP image manipulating easier and more expressive.

Error reading certain JPG's: "NotReadableException: Image source , I have the latest version installed in my Laravel 4 app, it works 80% of time time but for some reason certain JPG's cause it to throw a 500 error that says "Image source not readable". Sample image; Version of Intervention/Image; Version of GD or Imagick SilverPaladin commented on Dec 5, 2014  Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.

Image source not readable laravel 5.2 image package · Issue #587 , how to solve this problem? 'gd')); // Directory where we're storing uploaded images // Remember to set Tags : Example Image Image Upload intervention/image Laravel Laravel 4 Laravel 5 Laravel 5.2 Package Resize Image Scratch Thumbnails Hardik Savani My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech.

Intervention - St4k, 3. answers. 40.9k. views. Intervention / Image Upload Error {{ Image source not readable }} How to upload large size image by Intervention Image in Laravel 5. I have saved an image and wish to make a thumbnail. Forum Laravel 5.3 - Image source not readable. AbstractDecoder.php line 302: Image source not readable The

Comments
  • Could you please check this answer?
  • The problem in this code is, that $file->getRealPath() always returns false if there is a previous call to $file->move()
  • Could it be that you dont have permission (chmod 600)? Or maybe php.ini -> php_value post_max_size (maybe the image is too big)?
  • Nop, that not working I already tried. Image::make($file->getRealPath()) OR Image::make($file) give error as Image source not readable. It was working in Laravel 5 but not in L5.2.
  • And have you checked if the file is actually there, by manually looking into the directory? Also, try using a debugger to follow the code execution and see what is really happening.
  • @Tarunn I have explanation for that in this answer stackoverflow.com/questions/38923863/…
  • That seems to be what the original poster was already doing and apparently it didn't work.