Skip to content

Commit 8f8285b

Browse files
authored
Merge pull request #83 from theel0ja/patch-1
Improved formatting of markdown
2 parents 920cfbb + 6549ec5 commit 8f8285b

File tree

1 file changed

+54
-31
lines changed

1 file changed

+54
-31
lines changed

README.md

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ For Java, Cloudinary provides a library for simplifying the integration even fur
2525

2626
The cloudinary_java library is available in [Maven Central](https://repo1.maven.org/maven2/com/cloudinary/). To use it, add the following dependency to your pom.xml :
2727

28-
<dependency>
29-
<groupId>com.cloudinary</groupId>
30-
<artifactId>cloudinary-http44</artifactId>
31-
<version>1.13.0</version>
32-
</dependency>
28+
```xml
29+
<dependency>
30+
<groupId>com.cloudinary</groupId>
31+
<artifactId>cloudinary-http44</artifactId>
32+
<version>1.13.0</version>
33+
</dependency>
34+
```
3335

3436
Alternatively, download cloudinary_java from [here](https://repo1.maven.org/maven2/com/cloudinary/cloudinary-core/1.13.0/cloudinary-core-1.13.0.jar) and [here](https://repo1.maven.org/maven2/com/cloudinary/cloudinary-http44/1.13.0/cloudinary-http44-1.13.0.jar)
3537
and see [pom.xml](https://github.com/cloudinary/cloudinary_java/blob/master/cloudinary-http44/pom.xml) for library dependencies.
@@ -80,16 +82,19 @@ Setting the `cloud_name`, `api_key` and `api_secret` parameters can be done eith
8082
by when initializing the Cloudinary object, or by using the CLOUDINARY_URL environment variable / system property.
8183

8284
The entry point of the library is the Cloudinary object.
83-
84-
Cloudinary cloudinary = new Cloudinary();
85+
```java
86+
Cloudinary cloudinary = new Cloudinary();
87+
```
8588

8689
Here's an example of setting the configuration parameters programatically:
8790

88-
Map config = new HashMap();
89-
config.put("cloud_name", "n07t21i7");
90-
config.put("api_key", "123456789012345");
91-
config.put("api_secret", "abcdeghijklmnopqrstuvwxyz12");
92-
Cloudinary cloudinary = new Cloudinary(config);
91+
```java
92+
Map config = new HashMap();
93+
config.put("cloud_name", "n07t21i7");
94+
config.put("api_key", "123456789012345");
95+
config.put("api_secret", "abcdeghijklmnopqrstuvwxyz12");
96+
Cloudinary cloudinary = new Cloudinary(config);
97+
```
9398

9499
Another example of setting the configuration parameters by providing the CLOUDINARY_URL value to the constructor:
95100

@@ -101,21 +106,29 @@ Any image uploaded to Cloudinary can be transformed and embedded using powerful
101106

102107
The following example generates the url for accessing an uploaded `sample` image while transforming it to fill a 100x150 rectangle:
103108

104-
cloudinary.url().transformation(new Transformation().width(100).height(150).crop("fill")).generate("sample.jpg");
109+
```java
110+
cloudinary.url().transformation(new Transformation().width(100).height(150).crop("fill")).generate("sample.jpg");
111+
```
105112

106113
Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:
107114

108-
cloudinary.url().transformation(new Transformation().width(90).height(90).crop("thumb").gravity("face")).generate("woman.jpg");
115+
```java
116+
cloudinary.url().transformation(new Transformation().width(90).height(90).crop("thumb").gravity("face")).generate("woman.jpg");
117+
```
109118

110119
You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.
111120

112121
Embedding a Facebook profile to match your graphic design is very simple:
113122

114-
cloudinary.url().type("facebook").transformation(new Transformation().width(130).height(130).crop("fill").gravity("north_west")).generate("billclinton.jpg");
115-
123+
```java
124+
cloudinary.url().type("facebook").transformation(new Transformation().width(130).height(130).crop("fill").gravity("north_west")).generate("billclinton.jpg");
125+
```
126+
116127
Same goes for Twitter:
117128

118-
cloudinary.url().type("twitter_name").generate("billclinton.jpg");
129+
```java
130+
cloudinary.url().type("twitter_name").generate("billclinton.jpg");
131+
```
119132

120133
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/java_image_manipulation) for more information about displaying and transforming images in Java**.
121134

@@ -124,22 +137,28 @@ Same goes for Twitter:
124137
Assuming you have your Cloudinary configuration parameters defined (`cloud_name`, `api_key`, `api_secret`), uploading to Cloudinary is very simple.
125138

126139
The following example uploads a local JPG to the cloud:
127-
128-
cloudinary.uploader().upload("my_picture.jpg", ObjectUtils.emptyMap());
140+
141+
```java
142+
cloudinary.uploader().upload("my_picture.jpg", ObjectUtils.emptyMap());
143+
```
129144
130145
The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:
131146

132-
cloudinary.url().generate("abcfrmo8zul1mafopawefg.jpg");
133-
134-
# http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg
147+
```java
148+
cloudinary.url().generate("abcfrmo8zul1mafopawefg.jpg");
149+
150+
# http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg
151+
```
135152

136153
You can also specify your own public ID:
137-
138-
cloudinary.uploader().upload("http://www.example.com/image.jpg", ObjectUtils.asMap("public_id", "sample_remote"));
139154

140-
cloudinary.url().generate("sample_remote.jpg");
155+
```java
156+
cloudinary.uploader().upload("http://www.example.com/image.jpg", ObjectUtils.asMap("public_id", "sample_remote"));
157+
158+
cloudinary.url().generate("sample_remote.jpg");
141159

142-
# http://res.cloudinary.com/demo/image/upload/sample_remote.jpg
160+
# http://res.cloudinary.com/demo/image/upload/sample_remote.jpg
161+
```
143162

144163
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/java_image_upload) for plenty more options of uploading to the cloud from your Java code**.
145164

@@ -149,19 +168,23 @@ Returns an html image tag pointing to Cloudinary.
149168

150169
Usage:
151170

152-
cloudinary.url().format("png").transformation(new Transformation().width(100).height(100).crop("fill")).imageTag("sample");
171+
```java
172+
cloudinary.url().format("png").transformation(new Transformation().width(100).height(100).crop("fill")).imageTag("sample");
153173

154-
# <img src='http://res.cloudinary.com/cloud_name/image/upload/c_fill,h_100,w_100/sample.png' height='100' width='100'/>
174+
# <img src='http://res.cloudinary.com/cloud_name/image/upload/c_fill,h_100,w_100/sample.png' height='100' width='100'/>
175+
```
155176

156177
### imageUploadTag
157178

158179
Returns an html input field for direct image upload, to be used in conjunction with [cloudinary\_js package](https://github.com/cloudinary/cloudinary_js/). It integrates [jQuery-File-Upload widget](https://github.com/blueimp/jQuery-File-Upload) and provides all the necessary parameters for a direct upload.
159180

160181
Usage:
161182

162-
Map options = ObjectUtils.asMap("resource_type", "auto");
163-
Map htmlOptions = ObjectUtils.asMap("alt", "sample");
164-
String html = cloudinary.uploader().imageUploadTag("image_id", options, htmlOptions);
183+
```java
184+
Map options = ObjectUtils.asMap("resource_type", "auto");
185+
Map htmlOptions = ObjectUtils.asMap("alt", "sample");
186+
String html = cloudinary.uploader().imageUploadTag("image_id", options, htmlOptions);
187+
```
165188

166189
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/java_image_upload#direct_uploading_from_the_browser) for plenty more options of uploading directly from the browser**.
167190

0 commit comments

Comments
 (0)