Hard to help with no error message or code. What error are you getting?
Laravel 5 Image Upload and Resize.
I have problem with upload image and resize.
I cannot use Image::make();
Image::make();
Assumes you have properly installed intervention first of all, after that as @fraserk has said, not enough information.
Can i use Intervention with Laravel 5? can you prompt me its github? currently having issue uploading file to server
yeah ! I'm using it on L-5.
https://github.com/Intervention/image
Example code :
if(Input::file())
{
$image = Input::file('image');
$filename = time() . '.' . $image->getClientOriginalExtension();
$path = public_path('profilepics/' . $filename);
Image::make($image->getRealPath())->resize(200, 200)->save($path);
$user->image = $filename;
$user->save();
}
It will upload an Image in public/profilepics folder.
Their site has all you need http://image.intervention.io/
@LeeW Thanks for the link
@LeeW i was trying to use $file = $request->file('photo'); before but return null, any reason for that.. i've included enctype="multipart/form-data" in my form
I suspect you are wanting to check if the file exist and then do something with it, so something like.
if (Request::hasFile('photo'))
{
$file = Request::file('photo');
//and do this
}
@LeeW i received error messsage while installing intervention, any help
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for intervention/image 2.2.0 -> satisfiable by interv
ention/image[2.2.0].
- intervention/image 2.2.0 requires ext-fileinfo * -> the requested PHP exte
nsion fileinfo is missing from your system.
@cheasamnang use it
$file = Request::file('file');
$image_name = time()."-".$file->getClientOriginalName();
$file->move('uploads', $image_name);
$image = Image::make(sprintf('uploads/%s', $image_name))->resize(200, 200)->save();
requires ext-fileinfo
@samsoft This is missing from your server, you will need to install it.
Go to the php.ini file uncomment this line.
extension=php_fileinfo.dll
In php.ini
extension=php_fileinfo.dll
Thanks @Sonu @abhishek009 @LeeW checked it but its uncommented. duno what happen?
Restart your apache web server.
Unchecking it is not the issue, like I say, it's missing from your system, i.e not installed. The clue is in the error message
requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
Make sure you check all of php.ini for references to extension=php_fileinfo.dll and then restart apache or NGiNX, whatever you are using.
I've restart the apache web server after editing php.ini file. i'm using xampp... is there any php file apart from the one inside xampp folder? i type
which php --> /c/Program Files (x86)/iis express/PHP/v5.6/php
Waooo... it finally work, i was editing a wrong php.ini file... after typing "which php" and gave me the path to php i was using,
which php --> /c/Program Files (x86)/iis express/PHP/v5.6/php
Then i edit the php.ini inside the php folder. Thanks for your support guyz... i appreciate
What was missing is the 'use' statement at the top of your file in which you are including make() :
use Intervention\Image\ImageManagerStatic as Image;
supposing you have installed intervention correctly, look here for a full installation http://image.intervention.io/getting_started/installation#laravel
Hi. If I just need to upload an image (without resize), can I use only the Storage class?
if you are new programmer mybe not import the Image class used phpstorm ida its auto add namespace
Please or to participate in this conversation.