cloudinary_php: Missing a way to easily request every asset type

Feature request for Cloudinary PHP SDK

Explain your use case

I’m creating an adapter for cloudinary that could handle every sort of files.

Describe the problem you’re trying to solve

I wish to search an asset by name, without knowing if it’s a video, raw or image type.

Do you have a proposed solution?

Allowing ‘all’ value as ‘resource_type’ would be fine.

Code :

$this->adminApi->asset($path, ['resource_type' => AssetType::ALL])

Error : Cloudinary\Api\Exception\BadRequest: Invalid value all for parameter resource_type

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

You’re welcome!

@vasilvestre If you’re setting the public_id in your code then you don’t need to stop, however, the only requirement is that for “image” / “video” resource_type the extension should not be passed as part of the public_id but for “raw” assets the extension does need to be part of the public_id. So to know if you need to set the extension in the public_id or not you’d have to look at the MIME type of the file and determine what the “auto” resource_type in Cloudinary will determine the asset as. At that point, if you’re checking the MIME type you can set the resource_type explicitly too as you’ll know whether it’s an image/video/audio file or any other asset in which case it’ll be raw and should have the extension as part of the public_id.