codebar-ag / laravel-flysystem-cloudinary

Cloudinary Flysystem integration with Laravel.
https://www.cloudinary.com
MIT License
8 stars 5 forks source link

[Bug]: Unable to retrieve an uploaded file in Laravel 11 #61

Closed hamidroohani closed 3 months ago

hamidroohani commented 3 months ago

What happened?

When you define a folder in filesystem.php the file will upload to this dir correctly. But if you want to call the exists method on Storage you must add the folder in hard code for this method And the second problem is when you want to call the url method on Storage, you must delete the folder and put dubble file extension.

\Illuminate\Support\Facades\Storage::disk('cloudinary')->exists("mc/01J493QRS7S4AWYB3V522JN48B.jpg");

\Illuminate\Support\Facades\Storage::disk('cloudinary')->url("01J493QRS7S4AWYB3V522JN48B.jpg.jpg");

Package Version

4.2

PHP Version

8.3

Laravel Version

11.0.0

Which operating systems does with happen with?

macOS, Linux

RhysLees commented 3 months ago

Looking into this issue now

RhysLees commented 3 months ago

@hamidroohani

When you define a folder in filesystem.php the file will upload to this dir correctly. But if you want to call the exists method on Storage you must add the folder in hard code for this method

Just fixed this in #62

And the second problem is when you want to call the url method on Storage, you must delete the folder and put double file extension.

Please refer to the following section of the documentation: https://github.com/codebar-ag/laravel-flysystem-cloudinary?tab=readme-ov-file#-file-extension-problem

This is intended as you pass the extension as part of the file name, 01J493QRS7S4AWYB3V522JN48B.jpg would be the public_id in cloudinary. To remove this please see the documentation linked above. image

The second .jpg is the file type you wish to return, you can change the second extension to .webp for example. https://cloudinary.com/documentation/image_transformations#delivering_in_a_different_format

Please see the following for an in-detail explanation: https://github.com/codebar-ag/laravel-flysystem-cloudinary/issues/56#issuecomment-2025046863

StanBarrows commented 3 months ago

https://github.com/codebar-ag/laravel-flysystem-cloudinary/releases/tag/v4.2.1