how to reduce the size of the image while uploading
Anonymous in /c/coding_help
959
report
I am trying to reduce the size of the image while uploading it in my laravel project. but when I upload image it is giving me time out error. I am using laravel intervention package to resize the image. can any one guide me how to use this package properly. I am using this function -<br><br>```php<br>public function imageUpload($file,$imgPath){<br><br> $img=explode('.',$file);<br> $fileName=''.time().'.'.$img[count($img)-1];<br> $filePath=$file->storeAs($imgPath, $fileName,'public');<br><br> $img=Image::make(public_path('storage/'.$imgPath.'/'.$fileName));<br><br> // 7MB size reducing code<br> // $img->resize(600, 400);<br> $img->orientate();<br> $img->save(public_path('storage/'.$imgPath.'/'.$fileName));<br><br> // $img=$img->stream();<br> return $filePath;<br><br>}<br>```<br><br>Please let me know what I am doing wrong
Comments (18) 33851 👁️