Skip to content

Commit 875ca18

Browse files
author
Amir Tocker
committed
Update Readme with information on the Cloudinary JavaScript library. Related to #199
1 parent 8976aa2 commit 875ca18

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,54 @@ Cloudinary's Ruby GEM includes an optional plugin for [CarrierWave](https://gith
176176

177177
We also published an interesting blog post about [Ruby on Rails image uploads with CarrierWave and Cloudinary](http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary).
178178

179-
## Neo4j integration
179+
#### Neo4j integration
180180

181181
Starting from version 1.1.1 Cloudinary's Ruby GEM supports the use of carrierwave with Neo4j.
182182

183+
### JavaScript support library
184+
185+
During the installation or update of the Cloudinary GEM, the latest Cloudinary JavaScript library is automatically fetched and bundled with the GEM.
186+
187+
To use the JavaScript files you need to include them in your application, for example:
188+
189+
```
190+
<%= javascript_include_tag("jquery.ui.widget", "jquery.iframe-transport",
191+
"jquery.fileupload", "jquery.cloudinary") %>
192+
```
193+
194+
Alternatively, if you use Asset Pipeline, simply edit your application.js file and add the following line:
195+
196+
```
197+
//= require cloudinary
198+
```
199+
200+
To automatically set-up Cloudinary's configuration, include the following line in your view or layout:
201+
202+
```
203+
<%= cloudinary_js_config %>
204+
```
205+
206+
#### Uploading images from the browser
207+
208+
The Cloudinary JavaScript library utilizes the Blueimp File Upload library to support image uploading from the browser. See the [documentation](http://cloudinary.com/documentation/jquery_image_upload) for more details.
209+
210+
|Important|
211+
|---------|
212+
|Starting with version 2.0 of the Cloudinary JavaScript library, the Cloudinary extension to the Blueimp File Upload library is no longer initialized automatically. Instead you need to explicitly set it up as described below.|
213+
214+
To initialize the File Upload library with Cloudinary include the following code in your page:
215+
216+
```javascript
217+
$(function() {
218+
if($.fn.cloudinary_fileupload !== undefined) {
219+
$("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();
220+
}
221+
});
222+
```
223+
224+
225+
(`cloudinary_fileupload()` internally calls Blueimp's `fileupload()` so there's no need to call both.)
226+
183227
### Samples
184228

185229
You can find our simple and ready-to-use samples projects, along with documentation in the [samples folder](https://github.com/cloudinary/cloudinary_gem/tree/master/samples).

0 commit comments

Comments
 (0)