In my Laravel project, before I upload an image file, I resize it to a max width (about 1000 px). Therefore, the size of the file that will be stored in AWS S3 bucket will be smaller that the original file size.
How can I get the new size of the file that I have uploaded to AWS S3? I have the full path of the file in AWS S3 bucket, e.g. client/attachments/130/20220910213218631d0262ccde0-pexels-christina-morillo-1181686.jpg
I use Image/Intervention package to resize the image, e.g.
$image = Image::make($request->file('file'))
->resize(
$width,
null,
function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
}
);
$ok = Storage::disk('s3')->put($filepath, $image->stream());