Skip to content

Commit dc93746

Browse files
author
Nir Maoz
authored
Update cloudinary-jquery readme (#287)
1 parent ddfbb2b commit dc93746

File tree

3 files changed

+87
-227
lines changed

3 files changed

+87
-227
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Effortlessly optimize, transform, and upload your cloud's assets.
2020

2121
## Get Help
2222
If you run into an issue or have a question, you can either:
23-
- [Open a Github issue](https://github.com/CloudinaryLtd/cloudinary_js/issues) (for issues related to the SDK)
23+
- [Open a Github issue](https://github.com/Cloudinary/cloudinary_js/issues) (for issues related to the SDK)
2424
- [Open a support ticket](https://cloudinary.com/contact) (for issues related to your account)
2525

2626
## About Cloudinary

pkg/cloudinary-core/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ See [cloudinary-jquery-file-upload](https://github.com/cloudinary/cloudinary_js/
125125

126126
## Get Help
127127
If you run into an issue or have a question, you can either:
128-
- [Open a Github issue](https://github.com/CloudinaryLtd/cloudinary_js/issues) (for issues related to the SDK)
128+
- [Open a Github issue](https://github.com/Cloudinary/cloudinary_js/issues) (for issues related to the SDK)
129129
- [Open a support ticket](https://cloudinary.com/contact) (for issues related to your account)
130130

131131
## About Cloudinary

pkg/cloudinary-jquery/README.md

+85-225
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,55 @@
1-
[![Build Status](https://travis-ci.org/cloudinary/cloudinary_js.svg?branch=master)](https://travis-ci.org/cloudinary/cloudinary_js) [![npm](https://img.shields.io/npm/v/cloudinary-jquery.svg?maxAge=2592000)]() [![Bower](https://img.shields.io/bower/v/cloudinary-jquery.svg?maxAge=2592000)]() [![license](https://img.shields.io/github/license/cloudinary/pkg-cloudinary-jquery.svg?maxAge=2592000)]()
2-
3-
# Cloudinary Client Side JavaScript Library - jQuery Plugin<br>`bower` and `npm` repository
4-
5-
Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
6-
7-
Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.
8-
9-
Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.
10-
11-
Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
12-
13-
For Javascript, Cloudinary provides a jQuery plugin for simplifying the integration even further.
14-
15-
## Getting started guide
16-
17-
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **Take a look at our [Getting started guide for jQuery](http://cloudinary.com/documentation/jquery_integration#getting_started_guide)**.
1+
Cloudinary jQuery Plugin
2+
=======================================
3+
4+
## About
5+
The Cloudinary JQuery Plugin allows you to quickly and easily integrate your application with Cloudinary.
6+
Effortlessly optimize and transform your cloud's assets.
7+
8+
#### Note
9+
This Readme provides basic installation and usage information.
10+
For the complete documentation, see the [Javascript SDK Guide](https://cloudinary.com/documentation/jquery_integration).
11+
12+
13+
## Table of Contents
14+
- [Key Features](#key-features)
15+
- [Browser Support](#Browser-Support)
16+
- [Installation](#installation)
17+
- [Usage](#usage)
18+
- [Setup](#Setup)
19+
- [Transform and Optimize Assets](#Transform-and-Optimize-Assets)
20+
- [Generate Image and HTML Tags](#Generate-Image-and-Video-HTML-Tags)
21+
- [File upload](#File-upload)
22+
- [Contributions](#Contributions)
23+
- [About Cloudinary](#About-Cloudinary)
24+
- [Additional Resources](#Additional-Resources)
25+
- [Licence](#Licence)
26+
27+
## Key Features
28+
- [Transform](https://cloudinary.com/documentation/jquery_video_manipulation#video_transformation_examples) and [optimize](https://cloudinary.com/documentation/jquery_image_manipulation#image_optimizations) assets.
29+
- Generate [image](https://cloudinary.com/documentation/jquery_image_manipulation#deliver_and_transform_images) and [video](https://cloudinary.com/documentation/jquery_video_manipulation#video_element) tags.
30+
31+
## Browser Support
32+
Chrome, Safari, Firefox, IE 11
1833

1934
## Installation
35+
#### Install the package using:
36+
```bash
37+
npm install cloudinary-jquery
38+
```
39+
Or
40+
```bash
41+
yarn add cloudinary-jquery
42+
```
2043

21-
### bower
22-
23-
1. Install the files using the following command. Use the optional `--save` parameter if you wish to save the dependency in your bower.json file.
24-
25-
```shell
26-
bower install cloudinary-jquery
27-
```
28-
29-
1. Include the javascript file in your HTML. For Example:
30-
31-
```html
32-
<script src="bower_components/jquery/dist/jquery.js" type="text/javascript"></script>
33-
<script src="bower_components/cloudinary-jquery/cloudinary-jquery.js" type="text/javascript"></script>
34-
```
35-
36-
### NPM
37-
38-
1. Install the files using:
39-
40-
```shell
41-
npm install cloudinary-jquery
42-
```
43-
1. Include the javascript file in your HTML. For Example:
44-
44+
## Usage
45+
### Setup
46+
Include the javascript file in your HTML. For Example:
4547
```html
4648
<script src="node_modules/jquery/dist/jquery.js" type="text/javascript"></script>
4749
<script src="node_modules/cloudinary-jquery/cloudinary-jquery.js" type="text/javascript"></script>
4850
```
4951

50-
For the server side NPM library, please refer to https://github.com/cloudinary/cloudinary_npm.
51-
52-
## Setup
53-
54-
In order to properly use this library you have to provide it with a few configuration parameters:
55-
56-
Required:
57-
58-
* `cloud_name` - The cloudinary cloud name associated with your Cloudinary account.
59-
60-
Optional:
61-
62-
* `private_cdn`, `secure_distribution`, `cname`, `cdn_subdomain` - Please refer to [Cloudinary Documentation](http://cloudinary.com/documentation/rails_additional_topics#configuration_options) for information on these parameters.
63-
64-
To set these configuration parameters use the `Cloudinary::config` function (see below).
65-
66-
## Usage
67-
68-
The following blog post details the process of setting up a jQuery based file upload.
69-
http://cloudinary.com/blog/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery
70-
71-
The Cloudinary Documentation can be found at:
72-
http://cloudinary.com/documentation
73-
74-
### Cloudinary JavaScript library
75-
76-
The Cloudinary JavaScript library API reference can be found at: [https://cloudinary.github.io/pkg-cloudinary-jquery](https://cloudinary.github.io/pkg-cloudinary-jquery)
77-
78-
The Cloudinary JavaScript library provides several classes, defined under the "`cloudinary`" domain.
79-
80-
#### Configuration
81-
82-
Start by instantiating a new Cloudinary class:
52+
### There are several ways to configure cloudinary-jquery:
8353

8454
##### As jQuery plugin
8555

@@ -90,22 +60,19 @@ $.cloudinary.config({ cloud_name: "demo"});
9060
```
9161

9262
##### Explicitly
93-
9463
```javascript
95-
var cl = cloudinary.CloudinaryJQuery.new( { cloud_name: "demo"});
64+
var cl = cloudinary.Cloudinary.new( { cloud_name: "demo"});
9665
```
9766

9867
##### Using the config function
99-
10068
```javascript
10169

10270
// Using the config function
103-
var cl = cloudinary.CloudinaryJQuery.new();
71+
var cl = cloudinary.Cloudinary.new();
10472
cl.config( "cloud_name", "demo");
10573
```
10674

10775
##### From meta tags in the current HTML document
108-
10976
When using the library in a browser environment, you can use meta tags to define the configuration options.
11077

11178
The `init()` function is a convenience function that invokes both `fromDocument()` and `fromEnvironment()`.
@@ -138,164 +105,57 @@ var cl = cloudinary.Cloudinary.new();
138105
cl.fromEnvironment();
139106
// or
140107
cl.init();
141-
142108
```
143109

144-
#### URL generation
110+
### Transform and Optimize Assets
111+
- [See full documentation](https://cloudinary.com/documentation/jquery_image_manipulation)
145112

146113
```javascript
147-
cl.url("sample")
148-
// "http://res.cloudinary.com/demo/image/upload/sample"
149-
cl.url( "sample", { width: 100, crop: "fit"})
150-
// "http://res.cloudinary.com/demo/image/upload/c_fit,w_100/sample"
151-
152-
```
153-
154-
#### HTML tag generation
155-
156-
You can generate HTML tags in several ways:
157-
158-
`Cloudinary::image()` generates a DOM tag, and prepares it for responsive functionality. This is the same functionality as `$.cloudinary.image()`. (When using the jQuery plugin, the `src-cache` data attribute is stored using jQuery's `data()` method and so is not visible.)
159-
160-
```javascript
161-
cl.image("sample")
162-
```
163-
produces:
164-
```html
165-
<img src="http:​/​/​res.cloudinary.com/​demo/​image/​upload/​sample">​
166-
```
167-
168-
You can generate an image Tag using the `imageTag` function:
169-
170-
```javascript
171-
var tag = cl.imageTag("sample");
172-
tag.toHtml();
173-
```
174-
which produces:
175-
```html
176-
<img src="http://res.cloudinary.com/demo/image/upload/sample">
177-
```
178-
and:
179-
```javascript
180-
tag.transformation().crop("fit").width(100).toHtml();
181-
```
182-
which produces:
183-
```html
184-
<img src="http://res.cloudinary.com/demo/image/upload/c_fit,w_100/sample">
185-
```
186-
187-
You can also use `ImageTag` independently:
188-
189-
```javascript
190-
var tag = cloudinary.ImageTag.new( "sample", { cloud_name: "some_other_cloud" });
191-
tag.toHtml();
192-
```
193-
which produces:
194-
```html
195-
<img src="http://res.cloudinary.com/some_other_cloud/image/upload/sample">
196-
```
197-
198-
199-
#### Transformation
200-
201-
In addition to using a plain object to define transformations or using the builder methods (both described above), you can define transformations by using the Transformation class:
202-
203-
```javascript
204-
var tr = cloudinary.Transformation.new();
205-
tr.crop("fit").width(100);
206-
tr.serialize()
207-
// "c_fit,w_100"
208-
```
209-
210-
You can also chain transformations together:
211-
212-
```javascript
213-
var tr = cloudinary.Transformation.new();
214-
tr.width(10).crop('fit').chain().angle(15).serialize()
215-
// "c_fit,w_10/a_15"
216-
```
217-
218-
### jQuery plugin
219-
220-
This Cloudinary jQuery plugin is backward compatible with the previous [cloudinary_js](https://github.com/cloudinary/cloudinary_js) version - except that it does not contain the jquery-file-upload dependency and functionality. For a fully compatible version, including the Blueimp jquery file upload functionality, refer to [cloudinary-jquery-file-upload](https://www.github.com/cloudinary/pkg-cloudinary-jquery-file-upload)
221-
222-
When loaded, the new JavaScript library instantiates a CloudinaryJQuery object and attaches it to jQuery.
223-
224-
The following list includes a sample of the API provided by this library:
225-
226-
* `$.cloudinary.config(parameter_name, parameter_value)` - Sets parameter\_name's value to parameter\_value.
227-
* `$.cloudinary.url(public_id, options)` - Returns a cloudinary URL based on your configuration and the given options.
228-
* `$.cloudinary.image(public_id, options)` - Returns an HTML image tag for the photo specified by public\_id
229-
* `$.cloudinary.facebook_profile_image`, `$.cloudinary.twitter_profile_image`, `$.cloudinary.twitter_name_profile_image`, `$.cloudinary.gravatar_image` , `$.cloudinary.fetch_image` - Same as `image` but returns a specific type of image.
230-
231-
* `$(jquery_selector).cloudinary(options)` - Goes over the elements specified by the jQuery selector and changes all the images to be fetched using Cloudinary's CDN. Using options, you can also specify transformations to the images.
232-
The `options` parameters are similar across all cloudinary frameworks. Please refer to [jQuery image manipulation](http://cloudinary.com/documentation/jquery_image_manipulation) for a more complete reference regarding the options.
233-
234-
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/jquery_image_manipulation) for more information about displaying and transforming images using jQuery**.
235-
236-
### Other Cloudinary JavaScript libraries
237-
238-
#### Core Javascript library
239-
The Core Cloudinary JavaScript library does not depend on jQuery: [https://github.com/cloudinary/pkg-cloudinary-core](https://github.com/cloudinary/pkg-cloudinary-core).
240-
241-
#### jQuery File upload
242-
The Cloudinary jQuery File Upload library extends the Cloudinary jQuery plugin with support for the [Blueimp jQuery File Upload library](https://blueimp.github.io/jQuery-File-Upload/).
243-
The library can be found at [https://github.com/cloudinary/pkg-cloudinary-jquery-file-upload](https://github.com/cloudinary/pkg-cloudinary-jquery-file-upload).
244-
245-
## Client side image resizing before upload
246-
247-
See the File Processing Options in https://github.com/blueimp/jQuery-File-Upload/wiki/Options.
248-
Modify your script tags based on the the following example (order is important!):
249-
250-
```
251-
<script src="node_modules/jquery/dist/jquery.js" type="text/javascript"></script>
252-
<script src="node_modules/jquery.ui/ui/widget.js" type="text/javascript"></script>
253-
<script src="node_modules/blueimp-load-image/js/load-image.all.min.js"></script>
254-
<script src="node_modules/blueimp-canvas-to-blob/js/canvas-to-blob.min.js"></script>
255-
<script src="node_modules/blueimp-file-upload/js/jquery.iframe-transport.js" type="text/javascript"></script>
256-
<script src="node_modules/blueimp-file-upload/js/jquery.fileupload.js" type="text/javascript"></script>
257-
<script src="node_modules/blueimp-file-upload/js/jquery.fileupload-process.js"></script>
258-
<script src="node_modules/blueimp-file-upload/js/jquery.fileupload-image.js" type="text/javascript"></script>
259-
<script src="node_modules/blueimp-file-upload/js/jquery.fileupload-validate.js"></script>
260-
<script src="node_modules/cloudinary-jquery-file-upload/cloudinary-jquery-file-upload.js" type="text/javascript"></script>
261-
```
262-
263-
Also, add the following javascript:
264-
265-
```javascript
266-
$(document).ready(function() {
267-
$('.cloudinary-fileupload').cloudinary_fileupload({
268-
disableImageResize: false,
269-
imageMaxWidth: 800, // 800 is an example value
270-
imageMaxHeight: 600, // 600 is an example value
271-
maxFileSize: 20000000, // 20MB is an example value
272-
loadImageMaxFileSize: 20000000, // default is 10MB
273-
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|ico)$/i
274-
});
114+
// Apply a single transformation
115+
cl.url( "sample", { crop: "scale", width: "200", angle: "10" })
116+
117+
// Chain (compose) multiple transformations
118+
cl.url( "sample", {
119+
transformation: [
120+
{ angle: -45 },
121+
{ effect: "trim", angle: "45", crop: "scale", width: "600" },
122+
{ overlay: "text:Arial_100:Hello" }
123+
]
275124
});
276125
```
277126

278-
## Additional resources
279-
280-
Additional resources are available at:
281-
282-
* [Website](http://cloudinary.com)
283-
* [Documentation](http://cloudinary.com/documentation)
284-
* [Knowledge Base](http://support.cloudinary.com/forums)
285-
* [Documentation for jQuery integration](http://cloudinary.com/documentation/jquery_integration)
286-
* [jQuery image upload documentation](http://cloudinary.com/documentation/jquery_image_upload)
287-
* [jQuery image manipulation documentation](http://cloudinary.com/documentation/jquery_image_manipulation)
288-
* [Image transformations documentation](http://cloudinary.com/documentation/image_transformations)
127+
### Generate Image and Video HTML Tags
128+
- Use the ```image()``` function to generate an HTMLImageElement
129+
- Use the ```imageTag()``` function to generate an ImageTag instance
130+
- Use the ```video()``` function to generate an HTMLVideoElement
131+
- Use the ```videoTag()``` function to generate a VideoTag instance
289132

290-
## Support
133+
### File upload
134+
See [cloudinary-jquery-file-upload](https://github.com/cloudinary/cloudinary_js/tree/master/pkg/cloudinary-jquery-file-upload).
291135

292-
You can [open an issue through GitHub](https://github.com/cloudinary/cloudinary_js/issues).
136+
## Contributions
137+
- Ensure tests run locally (```npm run test```)
138+
- Open a PR and ensure Travis tests pass
293139

294-
Contact us at [http://cloudinary.com/contact](http://cloudinary.com/contact).
140+
## Get Help
141+
If you run into an issue or have a question, you can either:
142+
- [Open a Github issue](https://github.com/Cloudinary/cloudinary_js/issues) (for issues related to the SDK)
143+
- [Open a support ticket](https://cloudinary.com/contact) (for issues related to your account)
295144

296-
Stay tuned for updates, tips and tutorials: [Blog](http://cloudinary.com/blog), [Twitter](https://twitter.com/cloudinary), [Facebook](http://www.facebook.com/Cloudinary).
145+
## About Cloudinary
146+
Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.
297147

148+
## Additional Resources
149+
- [Cloudinary Transformation and REST API References](https://cloudinary.com/documentation/cloudinary_references): Comprehensive references, including syntax and examples for all SDKs.
150+
- [MediaJams.dev](https://mediajams.dev/): Bite-size use-case tutorials written by and for Cloudinary Developers
151+
- [DevJams](https://www.youtube.com/playlist?list=PL8dVGjLA2oMr09amgERARsZyrOz_sPvqw): Cloudinary developer podcasts on YouTube.
152+
- [Cloudinary Academy](https://training.cloudinary.com/): Free self-paced courses, instructor-led virtual courses, and on-site courses.
153+
- [Code Explorers and Feature Demos](https://cloudinary.com/documentation/code_explorers_demos_index): A one-stop shop for all code explorers, Postman collections, and feature demos found in the docs.
154+
- [Cloudinary Roadmap](https://cloudinary.com/roadmap): Your chance to follow, vote, or suggest what Cloudinary should develop next.
155+
- [Cloudinary Facebook Community](https://www.facebook.com/groups/CloudinaryCommunity): Learn from and offer help to other Cloudinary developers.
156+
- [Cloudinary Account Registration](https://cloudinary.com/users/register/free): Free Cloudinary account registration.
157+
- [Cloudinary Website](https://cloudinary.com): Learn about Cloudinary's products, partners, customers, pricing, and more.
298158

299-
## License
300159

160+
## Licence
301161
Released under the MIT license.

0 commit comments

Comments
 (0)