0

I'm trying to set this up on my project using this package https://github.com/cloudinary-labs/cloudinary-laravel but I haven't been successful.

I followed the setup on the GitHub but I'm not sure I did it right. I see these are needed in the .env

CLOUDINARY_URL=xxxxxxxxxxxxx
CLOUDINARY_UPLOAD_PRESET=xxxxxxxxxxxxx
CLOUDINARY_NOTIFICATION_URL=

And it says those are on the Account Dashboard but I can't see them I only have

Cloud name:
API Key:
API Secret: 
API Environment variable: CLOUDINARY_URL=cloudinary://***
Base delivery URL:
Secure delivery URL:
API Base URL:

The names don't match, except for the API Environment variable is the CLOUDINARY_URL, but other that one I don't know what goes where.

What do I put for the other two?

I'm also getting either a Guzzle connection error or this

Cloudinary\Api\Exception\GeneralError Server returned unexpected status code - 504 -

What am I doing wrong?

bhucho
  • 3,903
  • 3
  • 16
  • 34
Nancy
  • 1,021
  • 4
  • 23
  • 45

2 Answers2

0

First I should clarify that cloudinary-laravel is sill in Labs and should not be used for production purposes.

To answer your question, CLOUDINARY_NOTIFICATION_URL as you mentioned in the comment, is a webhook notification mechanism to informing your backend about certain actions. Please refer to https://cloudinary.com/documentation/notifications for more information. So this would be your application endpoint. I'm guessing you are getting 504 is due to the endpoint getting a connection time out.

CLOUDINARY_UPLOAD_PRESET is an upload preset that you need to set it up on your account first. To learn how to set it up, please also check the following documentation: https://cloudinary.com/documentation/upload_presets.

Hope this helps. If you still stuck, I recommend to open a support ticket with all the details you have in Cloudinary's Support portal

Regards, Erwin Lukas

Leptians
  • 96
  • 4
  • I removed it and went with the php server side setup instead. Since you know about the topic you think you could help me update an image? This is how I uploaded it ``` \Cloudinary\Uploader::upload( $request->file('image'), $options = array("folder" => "categories/", 'public_id' => $request->name) ); ``` Looking at the docs it says this is the way ``` $api->update($public_id, $options = array()); ``` But they don't explain what `$api` is a variable of, or how to set it. – Nancy Jan 13 '21 at 23:22
  • `$api->update()` is part of Cloudinary's Admin API's [update](https://cloudinary.com/documentation/admin_api#update_details_of_an_existing_resource) method. `$api` is the Cloudinary's Admin API's object that needs to be defined first as follow: `$api = new \Cloudinary\Api();` Please check the example [here](https://cloudinary.com/documentation/php_asset_administration#example). From your code, I'm not sure what you are trying to update. For most situation, you may want to check [explicit](https://cloudinary.com/documentation/image_upload_api_reference#explicit_method) method. – Leptians Jan 14 '21 at 01:00
  • I'm trying to update the image but keep the same url – Nancy Jan 14 '21 at 14:33
  • Update as in a new image but with the same public id? If yes, then you should [Uploda](https://cloudinary.com/documentation/image_upload_api_reference#upload_method) end point and pass the same public id as the parameter. You may also want to set `"invalidate"=>true` to make sure the CDN is invalidated – Leptians Jan 15 '21 at 22:42
0

At least to upload a file to Cloudinary, the only thing you need is the API Environment variable. So in your .env file, you would paste the API Environment variable in this manner:

CLOUDINARY_URL=cloudinary://YOUR_API_KEY:****************************

Note that after you copied the API Environment variable, you will need to remove the leading 'CLOUDINARY_URL'.

Hence this is wrong: CLOUDINARY_URL=CLOUDINARY_URL=cloudinary://...

You don't need to set the CLOUDINARY_NOTIFICATION_URL to get it off with basic uploading.

Olu Adeyemo
  • 825
  • 9
  • 17