I am attempting to get the dimensions of an image file that IS successfully uploading to my public/images folder which IS correctly symlinked via Laravel to the storage/public folder. I am using PHP's getimageinfo
function.
To store the file, I have used the built in ->store('pathtodirectory', 'public')
to save the file to the server, which is working. It correctly returns the path/filename associated with the image, and properly saves the file which I can confirm and view.
However! When I attempt to use the getimageinfo
function it tells me 'failed to open stream'. I have attempted to use the Storage::url
, and the storage_path
functions to grab a path to the file and pass that into getimageinfo
. I have attempted to use the Laravel asset
function as well. Nothing is working.
What am I missing?
Code:
$photo = $request->file('image');
$imageFilePath = $photo->store('images', 'public');
$imageDimensions = getImageSize(Storage::url($imageFilePath));<--Fails here
My config/filesystems.php:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire