jbcpollak / cloudinary_angular

Deprecated: Cloudinary now offers an official Angular library -
https://github.com/cloudinary/cloudinary_angular
MIT License
32 stars 12 forks source link

directly input image url into the directive #14

Closed 2013gang closed 9 years ago

jbcpollak commented 10 years ago

Hi, I'm not exactly sure what you mean. Also keep in mind there is an official Cloudinary Angular directive now. https://github.com/cloudinary/cloudinary_angular

2013gang commented 9 years ago

Hi @jbcpollak, I am aware of the official angular directive, great stuff. I have not dived deep into it yet. I just have a question about how we put coudinary api key and api secret into front end. And if we do put these info in the js, it may have some security problem, ppl may be able to retrieve it.

This is why I am thinking if in the Angular directive, it can accept cloudinary url directly. Please correct me if this concern is unnecessary. Thanks

jbcpollak commented 9 years ago

Hi, it is OK to put the api-key into the javascript. DO NOT put the api secret in your client code. That should ONLY be available on the server.

The way client-side upload works is it constructs a data object with the upload parameters on the client side, and sends it to your server, which signs it with the api secret and returns that result.

The client can then upload the image with the the signed parameters, and Cloudinary can verify the upload was approved.

jbcpollak commented 9 years ago

You can see here: https://github.com/jbcpollak/cloudinary_angular#upload-tag

There is an $http.get() call to a URL on your server. This is the request to sign the parameters.

2013gang commented 9 years ago

Got it. Thanks for the explanation. But do you think it would be useful that the angular directive can take the cloudinary url directly too?

jbcpollak commented 9 years ago

Hi, I guess I'm confused, are you talking about to upload or display images? For upload it doesn't make sense. To display images, if you are going to put the full cloudinary URL in, you might as well just use an <img> tag and you won't need the directive at all.

2013gang commented 9 years ago

my bad. You are right. Closing this.