Dev0ps's avatar

how to compress image size using intervention

after upload image size was still the same.

$file = Input::file('file');
                        $file_name = md5(uniqid() . time()) . '.' . $file->getClientOriginalExtension();
                        //                $directory = '\uploads\user_post_media'; //windows
                        $directory = '/storage/uploads/user_post_media'; //linux
                        $file->move(public_path().$directory, $file_name);
                        $imgsource = $directory.'/'.$file_name;
                        //                $image = $image->resize($width, null, true);

                        $source_img = public_path('storage/uploads/user_post_media/'.$file_name);
                        //                $destination_img = public_path('storage/uploads/user_post_media/'.$file_name);

                        $img = Image::make($source_img);
                        if(!$file->getClientOriginalExtension() == "gif"){
                            $img->save($source_img, 60);
                        }

thanks in advance

0 likes
1 reply
mvd's avatar

Hi @dev0ps,

What kind of image extension do you use (png/jpg)?

Define optionally the quality of the image. It is normalized for all file types to a range from 0 (poor quality, small file) to 100 (best quality, big file). Quality is only applied if you're encoding JPG format since PNG compression is lossless and does not affect image quality. The default value is 90.

Please or to participate in this conversation.