Reputation: 148
I want to resize my images with Intervention Image package.
My application is working smoothly when uploading small size images. But when I try to upload a large size image, my application stops working on the deployment server!
Locally my code is working fine, but I'm getting this error on my deployment server:
(1/1) NotReadableException, Image source not readable
Here is my code:
$files= Input::file('image');
foreach($files as $file){
$image_resize = Image::make($file->getRealPath());
$image_resize->resize(300, 300);
$image_resize->save(public_path('images/gallery/small/' .$imageName));
}
How can I fix this? Please explain me.
Upvotes: 3
Views: 659
Reputation: 878
Have you checked the values of upload_max_filesize
and post_max_size
on your server? If you can't access your php.ini
directly, this code may help to determine it:
<?php
echo ini_get('post_max_size') . '<br>';
echo ini_get('upload_max_filesize');
?>
This comment on a GitHub issue makes me believe that your error can be thrown when you're trying to upload a file that's bigger than your server will accept.
You can tackle this by increasing the maximum sizes in your php.ini
and additionally, since there will still be a maximum that you'll accept, checking the max_file_size
on the client side: <input type="hidden" name="MAX_FILE_SIZE" value="123456">
.
Upvotes: 4