Skip to content

Commit 191c247

Browse files
committed
add support for opacity
1 parent 9a5b374 commit 191c247

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cloudinary-core/src/main/java/com/cloudinary/Transformation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public Transformation() {
6464
public Transformation density(Object value) { return param("density", value); }
6565
public Transformation page(Object value) { return param("page", value); }
6666
public Transformation delay(Object value) { return param("delay", value); }
67+
public Transformation opacity(int value) { return param("opacity", value); }
6768
public Transformation rawTransformation(String value) { return param("raw_transformation", value); }
6869
public Transformation flags(String...value) { return param("flags", value); }
6970

@@ -166,7 +167,7 @@ public Object transform(Object baseTransformation) {
166167
String[] simple_params = new String[]{
167168
"x", "x", "y", "y", "r", "radius", "d", "default_image", "g", "gravity", "cs", "color_space",
168169
"p", "prefix", "l", "overlay", "u", "underlay", "f", "fetch_format", "dn", "density",
169-
"pg", "page", "dl", "delay", "e", "effect", "bo", "border", "q", "quality"
170+
"pg", "page", "dl", "delay", "e", "effect", "bo", "border", "q", "quality", "o", "opacity"
170171
};
171172
for (int i = 0; i < simple_params.length; i+=2) {
172173
params.put(simple_params[i], Cloudinary.asString(options.get(simple_params[i+1])));

cloudinary-core/src/test/java/com/cloudinary/test/CloudinaryTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ public void testFlags() {
332332
result = cloudinary.url().transformation(transformation).generate("test");
333333
assertEquals("http://res.cloudinary.com/test123/image/upload/fl_abc.def/test", result);
334334
}
335+
336+
@Test
337+
public void testOpacity() {
338+
// should support opacity
339+
Transformation transformation = new Transformation().opacity(50);
340+
String result = cloudinary.url().transformation(transformation).generate("test");
341+
assertEquals("http://res.cloudinary.com/test123/image/upload/o_50/test", result);
342+
}
335343

336344
@Test
337345
public void testImageTag() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy