Package com.cloudinary

Examples of com.cloudinary.Transformation


        result = cloudinary.uploader().upload("src/test/resources/logo.png", Cloudinary.asMap("use_filename", true, "unique_filename", false));
  assertEquals((String) result.get("public_id"), "logo");
  }
    @Test
  public void testExplicit() throws IOException {
        Map result = cloudinary.uploader().explicit("cloudinary", Cloudinary.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0)), "type", "twitter_name"));
        String url = cloudinary.url().type("twitter_name").transformation(new Transformation().crop("scale").width(2.0)).format("png").version(result.get("version")).generate("cloudinary");
        String eagerUrl = (String) ((Map) ((List)result.get("eager")).get(0)).get("url");
        String cloudName = cloudinary.getStringConfig("cloud_name");
        assertEquals(eagerUrl.substring(eagerUrl.indexOf(cloudName)), url.substring(url.indexOf(cloudName)));       
    }
View Full Code Here


        assertEquals(eagerUrl.substring(eagerUrl.indexOf(cloudName)), url.substring(url.indexOf(cloudName)));       
    }

    @Test
  public void testEager() throws IOException {
        cloudinary.uploader().upload("src/test/resources/logo.png", Cloudinary.asMap("eager", Collections.singletonList(new Transformation().crop("scale").width(2.0))));
    }
View Full Code Here

        cloudinary.uploader().upload("src/test/resources/logo.png", Cloudinary.asMap("tags", "sprite_test_tag", "public_id", "sprite_test_tag_2"));
        Map result = cloudinary.uploader().generate_sprite("sprite_test_tag", Cloudinary.emptyMap());
        assertEquals(2, ((Map) result.get("image_infos")).size());
        result = cloudinary.uploader().generate_sprite("sprite_test_tag", Cloudinary.asMap("transformation", "w_100"));
        assertTrue(((String) result.get("css_url")).contains("w_100"));
        result = cloudinary.uploader().generate_sprite("sprite_test_tag", Cloudinary.asMap("transformation", new Transformation().width(100), "format", "jpg"));
        assertTrue(((String) result.get("css_url")).contains("f_jpg,w_100"));
    }
View Full Code Here

        cloudinary.uploader().upload("src/test/resources/logo.png", Cloudinary.asMap("tags", "multi_test_tag", "public_id", "multi_test_tag_2"));
        Map result = cloudinary.uploader().multi("multi_test_tag", Cloudinary.emptyMap());
        assertTrue(((String) result.get("url")).endsWith(".gif"));
        result = cloudinary.uploader().multi("multi_test_tag", Cloudinary.asMap("transformation", "w_100"));
        assertTrue(((String) result.get("url")).contains("w_100"));
        result = cloudinary.uploader().multi("multi_test_tag", Cloudinary.asMap("transformation", new Transformation().width(111), "format", "pdf"));
        assertTrue(((String) result.get("url")).contains("w_111"));
        assertTrue(((String) result.get("url")).endsWith(".pdf"));
    }
View Full Code Here

public class CloudinaryTransformationTag extends SimpleTagSupport implements DynamicAttributes {
    private Map<String,Object> tagAttrs = new HashMap<String,Object>();

    public void doTag() throws JspException, IOException {
        Transformation transformation = new Transformation().params(tagAttrs);
        getJspContext().getOut().print(transformation.generate());
    }
View Full Code Here

    public String getThumbnailUrl() {
        if (version != null && format != null && publicId != null) {
            return Singleton.getCloudinary().url().format(format)
                    .resourceType(resourceType)
                    .type(type)
                    .version(version).transformation(new Transformation().width(150).height(150).crop("fit"))
                    .generate(publicId);
        } else return null;
    }
View Full Code Here

    public String getThumbnailUrl() {
        if (version != null && format != null && publicId != null) {
            return Singleton.getCloudinary().url().format(format)
                    .resourceType(resourceType)
                    .type(type)
                    .version(version).transformation(new Transformation().width(150).height(150).crop("fit"))
                    .generate(publicId);
        } else return null;
    }
View Full Code Here

TOP

Related Classes of com.cloudinary.Transformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.