Reputation: 11
I created Cloudinary account and made a "posts" folder.
I want to store all images upload on posts folder but I don't know how to do that.
I'm using this package https://github.com/jrm2k6/cloudder
Upvotes: 1
Views: 1349
Reputation: 762
So let's say the name of the folder is posts
$image_path = $request->file('image_name')->getRealPath();
Cloudder::upload($image_path, null, array("folder" => "posts", "overwrite" => TRUE, "resource_type" => "image"));
the null parameter allows cloudinary to generate a unique public id for the uploaded image.
public_id: "posts/unique_id.png",
Upvotes: 1
Reputation: 301
Here is a sample code:
\Cloudinary\Uploader::upload("myImage.jpg",
array("folder" => "my_folder/my_sub_folder/", "public_id" => "my_image", "overwrite" => TRUE,
"resource_type" => "image"))
Upvotes: 3