Ad

Uploading Images To Cloudinary - Laravel

- 1 answer

In CloudinaryController im getting local file(image) from $request and upload it to Cloudinary

public static function uploadImage($path, $image_name, $id)
    {
       Cloudder::upload($path, $image_name);
       $image_url= Cloudder::show(Cloudder::getPublicId());
       $this->saveImage($image_url, $id); // saving url to DB
       return redirect()->back()->with('status', 'Image Uploaded Successfully');
    }

How can i upload image with code above to directory home/users instead of home?

Ad

Answer

Cloudianry supports the folder parameter when uploading.

So you could set the folder parameter to home/users to have the image uploaded to that folder.

Although we don't support the cloudder wrapper officially it looks like you could add the folder parmaeter to $options in cloudder

i.e change Cloudder::upload($path, $image_name); to Cloudder::upload($path, $options, $image_name);

Ad
source: stackoverflow.com
Ad