|
| 1 | +Cloudinary |
| 2 | +========== |
| 3 | + |
| 4 | +Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline. |
| 5 | + |
| 6 | +Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. |
| 7 | +Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. |
| 8 | +Images are seamlessly delivered through a fast CDN, and much much more. |
| 9 | + |
| 10 | +Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new. |
| 11 | + |
| 12 | +Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework. |
| 13 | + |
| 14 | +For Android, Cloudinary provides a library for simplifying the integration even further. The library requires Android 2.3 or higher. |
| 15 | + |
| 16 | +## Manual Setup ###################################################################### |
| 17 | +Download cloudinary-core-1.0.15.jar from [here](http://res.cloudinary.com/cloudinary/raw/upload/cloudinary-core-1.0.15.jar) and cloudinary-android-1.0.15.jar from [here](http://res.cloudinary.com/cloudinary/raw/upload/cloudinary-android-1.0.15.jar) |
| 18 | +and put them in your libs folder. |
| 19 | + |
| 20 | +## Maven Integration ###################################################################### |
| 21 | +The cloudinary_java library is available in [Maven Central](http://repo1.maven.org/maven/). To use it, add the following dependency to your pom.xml: |
| 22 | + |
| 23 | + <dependency> |
| 24 | + <groupId>com.cloudinary</groupId> |
| 25 | + <artifactId>cloudinary-android</artifactId> |
| 26 | + <version>1.0.15</version> |
| 27 | + </dependency> |
| 28 | + |
| 29 | + |
| 30 | +## Try it right away |
| 31 | + |
| 32 | +Sign up for a [free account](https://cloudinary.com/users/register/free) so you can try out image transformations and seamless image delivery through CDN. |
| 33 | + |
| 34 | +*Note: Replace `demo` in all the following examples with your Cloudinary's `cloud name`.* |
| 35 | + |
| 36 | +Accessing an uploaded image with the `sample` public ID through a CDN: |
| 37 | + |
| 38 | + http://res.cloudinary.com/demo/image/upload/sample.jpg |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +Generating a 150x100 version of the `sample` image and downloading it through a CDN: |
| 43 | + |
| 44 | + http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +Converting to a 150x100 PNG with rounded corners of 20 pixels: |
| 49 | + |
| 50 | + http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +For plenty more transformation options, see our [image transformations documentation](http://cloudinary.com/documentation/image_transformations). |
| 55 | + |
| 56 | +Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton: |
| 57 | + |
| 58 | + http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +For more details, see our documentation for embedding [Facebook](http://cloudinary.com/documentation/facebook_profile_pictures) and [Twitter](http://cloudinary.com/documentation/twitter_profile_pictures) profile pictures. |
| 63 | + |
| 64 | + |
| 65 | +## Usage |
| 66 | + |
| 67 | +### Configuration |
| 68 | + |
| 69 | +Each request for building a URL of a remote cloud resource must have the `cloud_name` parameter set. |
| 70 | +Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the `api_key` and `api_secret` parameters set. |
| 71 | +See [API, URLs and access identifiers](http://cloudinary.com/documentation/api_and_access_identifiers) for more details. |
| 72 | + |
| 73 | +Setting the `cloud_name`, `api_key` and `api_secret` parameters can be done either directly in each call to a Cloudinary method, |
| 74 | +by when initializing the Cloudinary object, or by using the CLOUDINARY_URL meta-data property. |
| 75 | + |
| 76 | +The entry point of the library is the Cloudinary object. |
| 77 | + |
| 78 | +Here's an example of setting the configuration parameters programatically: |
| 79 | + |
| 80 | + Map config = new HashMap(); |
| 81 | + config.put("cloud_name", "n07t21i7"); |
| 82 | + config.put("api_key", "123456789012345"); |
| 83 | + config.put("api_secret", "abcdeghijklmnopqrstuvwxyz12"); |
| 84 | + Cloudinary cloudinary = new Cloudinary(config); |
| 85 | + |
| 86 | +Another example of setting the configuration parameters by providing the CLOUDINARY_URL value to the constructor: |
| 87 | + |
| 88 | + Cloudinary cloudinary = new Cloudinary("cloudinary://123456789012345:abcdeghijklmnopqrstuvwxyz12@n07t21i7"); |
| 89 | + |
| 90 | +Giving the context will allow Cloudinary to configure from the application's meta-data. |
| 91 | + |
| 92 | + Cloudinary cloudinary = new Cloudinary(Utils.cloudinaryUrlFromContext(getContext())); |
| 93 | + |
| 94 | +Then add a meta-data property to your application section in the AndroidManifest.xml |
| 95 | + |
| 96 | + <manifest> |
| 97 | + ... |
| 98 | + <application> |
| 99 | + ... |
| 100 | + <meta-data android:name="CLOUDINARY_URL" android:value="cloudinary://123456789012345:abcdeghijklmnopqrstuvwxyz12@n07t21i7"/> |
| 101 | + </application> |
| 102 | + <manifest> |
| 103 | + |
| 104 | +### Embedding and transforming images |
| 105 | + |
| 106 | +Any image uploaded to Cloudinary can be transformed and embedded using powerful view helper methods: |
| 107 | + |
| 108 | +The following example generates the url for accessing an uploaded `sample` image while transforming it to fill a 100x150 rectangle: |
| 109 | + |
| 110 | + cloudinary.url().transformation(new Transformation().width(100).height(150).crop("fill")).generate("sample.jpg") |
| 111 | + |
| 112 | +... |
| 113 | + |
0 commit comments