nanadjei2's avatar

Resize uploading image

Please i have this in my controller. $file = Input::file("image"); $file->move('uploads', $file->getClientOriginalName()); $image_Url = asset('uploads/'.$File->getClientOriginalName());

Buh anytime am uploading an image with a particular size i get an error saying the size is too much to upload. Can anyone help me to resize it when uploading?

0 likes
17 replies
krekas's avatar

Are you doing any validation on file size?

nanadjei2's avatar

@bobbybouwmann i wanted to install image.intervention via composer but cmd gives me an error saying "php composer. Phar require intervention/image could not open input file: composer.phar"

bobbybouwmann's avatar

Well this is a composer issue on your end. This has nothing to do with the intervention package. Make sure you are at the root level of your project and run the following

composer require intervention/image
sid405's avatar

@bobbybouwmann He's still gonna get an error if the issue is php.ini, which i assume it is, because @nanadjei2 is doing no validation.

If we could actually take a look at a real error message, where is displayed and who's throwing it, we just might get this solved :D

nanadjei2's avatar

@sid405 this is the error "The file image.jpg exceeds your upload_max_filesize ini directive (limit is 2048 KiB)"

sid405's avatar

@nanadjei2 OKay then it's time to modify that file. What is your setup like? Platform and webserver i mean.

Btw, probably uploading 2MB images is not a good idea in the first place, but then depends what you doing with them.

nanadjei2's avatar

@sid405 sorry, i was off for sometime. but i still couldn't install it. can you guide into the step-to-step of how am going to install the package? or do you have any other way you can help me fix this image resize problem?

sid405's avatar

@nanadjei2 As you stated the error you get is ""The file image.jpg exceeds your upload_max_filesize ini directive (limit is 2048 KiB)" Right?

This is not package issue, you have to modify your php.ini.

Are you on shared hosting or for you have a VPS os something of the like?

sid405's avatar
sid405
Best Answer
Level 27

@nanadjei2 If you are using Windows and XAMPP, your php.ini file is in the PHP directory of XAMPP, so xampp/php/php.ini is the path. Open it and look for upload_max_filesize. Increase it to your desired value, save and restart Apache.

1 like

Please or to participate in this conversation.