Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

How get cloudinary file url/other properties by public_id?

Saving images under cloudinary( with cloudinary-laravel 1.0) I keep public_id in my database and I want to get url(http or https), size, dimaentainal of this file by public_id

At reading this

/**
 * You can also retrieve a url if you have a public id
 */

$url = Storage::disk('cloudinary')->url($publicId);

at https://github.com/cloudinary-labs/cloudinary-laravel

I got ERROR:

Disk [CLOUDINARY] does not have a configured driver.

  
  

But I save images to cloudinary with storeOnCloudinaryAs method and in my .env I have

CLOUDINARY_URL=cloudinary://NNNNNNNNNNNN:AErjB_-XXXXXXXXX
CLOUDINARY_UPLOAD_PRESET=ml_default

and default file config/cloudinary.php My config/filesystems.php has no any cloudinary parameters and can it be reason of my error?

Also it seems very strange for me that Storage::was used in this case, but I did not find how get file url/other properties by public_id ?

Thanks in advance!

0 likes
8 replies
SilenceBringer's avatar

@petrogromovo try to add CloudinaryServiceProvider to your providers list in config/app.php.

It has bootCloudinaryDriver method to configure driver

PetroGromovo's avatar

I added line

    ...
    CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider::class,
    ...

in 'providers' block of ny config/app.php and cleared cach. But still got

"Disk [CLOUDINARY] does not have a configured driver."

error.

Have I to edit config/filesystems.php or other config files ?

SilenceBringer's avatar

@petrogromovo when you have dash in value - you need to wrap the value in quotes

CLOUDINARY_URL="cloudinary://NNNNNNNNNNNN:AErjB_-XXXXXXXXX"

did you try this?

PetroGromovo's avatar

applying changes into .env and clearing cache I try to debug from which line error is triggered in file vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php as :

    protected function resolve($name)
    {
        $config = $this->getConfig($name);

        \Log::info(  varDump($name, ' -1 $name resolve::') ); // IT HAS ‘CLOUDINARY’ value
        if (empty($config['driver'])) {
            throw new InvalidArgumentException("Disk [{$name}] does not have a configured driver.");
        }

But what is source for $config in this file?

config/filesystems.php ? In this file I have no any CLOUDINARY block. maybe I need to add it? But in which format ?

PetroGromovo's avatar
PetroGromovo
OP
Best Answer
Level 5

Setting driver to lowercase

$cloudinaryUrl = Storage::disk(strtolower($imagesUploadSource))

fixed this error.

Please or to participate in this conversation.