cloudinary-community / cloudinary-laravel

Laravel SDK for Cloudinary
MIT License
269 stars 71 forks source link

Discrepancy file extention between upload and get the file #124

Closed hamidroohani closed 1 month ago

hamidroohani commented 1 month ago

When I upload an image into Cloudinary I will get 01J562MWE7WGBKVENZV50BYH39.jpg as a result and put it into DB. But when I want to check if file exists or not, or even show it, I must remove the file extension and call like:

\Illuminate\Support\Facades\Storage::disk('cloudinary')->exists("01J562MWE7WGBKVENZV50BYH39");
colbyfayock commented 1 month ago

@joshmanders just to provide some context on how the public IDs work, I'm not sure how the SDK is managing this, but the file extension is not required when constructing URLs

ex: res.cloudinary.com/.../publicid.jpg and res.cloudinary.com/.../publicid both work

I typically encourage not including it just for the sake of clarity, as you can additionally provide transformations to change that format, so having the extension can be confusing, but it's supported to be able to provide the extension, which i would have expected this to be handled by the underlaying PHP SDK depending on what this touches (as im not familiar)

one question i have is the stored result, is this storing only the public ID? is this storing the full resource object? if this is storing just the public ID, I would expect that the ID would be stored without the extension, but we would need to make sure thats not a breaking change as it could break a lot of implementations

joshmanders commented 1 month ago

I will look into this, thank you for the added context @colbyfayock