In laravel 8 uploading image to AWS S3 and I keep url in db table(I set visibility= 'public', so I can show image in my browser by this saved url. Also I need to get width, height, filesize of this file. When I use Storage in local I use Intervention\Image library with methods :
$file_width = Image::make($image_path)->width();
$file_height = Image::make($image_path)->height();
$file_size = Image::make($image_path)->filesize();
where $image_path - is path under my Storage.
With Object URL property my uploaded image has properties S3 URI looking like
s3://app-s3/subdir/filepath.jpg
and Amazon Resource Name (ARN) :
arn:aws:s3:::app-s3/app-s3/subdir/filepath/31fzgzXsVTL.jpg
How can I to read width, height, filesize of image in s3 ?
MODIFIED BLOCK : Reading at https://laravel.com/docs/8.x/filesystem#file-metadata link example code:
use Illuminate\Support\Facades\Storage;
$size = Storage::size('file.jpg');
I try with get size with ‘s3’ driver:
$image_size = Storage::disk('s3')->size($cloud_url);
I got error :
File not found at path: https:/app-s3.s3.eu-central-1.amazonaws.com/app-s3/subdir/filepath/31fzgzxsvtl.jpg
As $cloud_url is common url, not path ... From the docs looks like 'file.jpg' is PATH of the image in Storage directory. But I am not sure...
Thanks in advance!