com.cloudinary.Url.sourceTransformationFor()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中com.cloudinary.Url.sourceTransformationFor()方法的一些代码示例,展示了Url.sourceTransformationFor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.sourceTransformationFor()方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:sourceTransformationFor

Url.sourceTransformationFor介绍

暂无

代码示例

代码示例来源:origin: cloudinary/cloudinary_java

transformation = new Transformation().rawTransformation((String) transformationAttrValue);
url.sourceTransformationFor(sourceType, transformation );

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testVideoTagWithSourceTransformation() {
  String expectedUrl = VIDEO_UPLOAD_PATH + "q_50/w_100/movie";
  String expectedOgvUrl = VIDEO_UPLOAD_PATH + "q_50/w_100/q_70/movie";
  String expectedMp4Url = VIDEO_UPLOAD_PATH + "q_50/w_100/q_30/movie";
  String expectedTag = "<video poster='%s.jpg' width='100'>"
      + "<source src='%s.webm' type='video/webm'>"
      + "<source src='%s.mp4' type='video/mp4'>"
      + "<source src='%s.ogv' type='video/ogg'>"
      + "</video>";
  expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedMp4Url, expectedOgvUrl);
  String actualTag = cloudinary.url().transformation(new Transformation().quality(50).chain().width(100))
      .sourceTransformationFor("mp4", new Transformation().quality(30))
      .sourceTransformationFor("ogv", new Transformation().quality(70))
      .videoTag("movie", emptyMap());
  assertEquals(expectedTag, actualTag);
  expectedTag = "<video poster='%s.jpg' width='100'>" + "<source src='%s.webm' type='video/webm'>"
      + "<source src='%s.mp4' type='video/mp4'>" + "</video>";
  expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedMp4Url);
  actualTag = cloudinary.url().transformation(new Transformation().quality(50).chain().width(100))
      .sourceTransformationFor("mp4", new Transformation().quality(30))
      .sourceTransformationFor("ogv", new Transformation().quality(70))
      .sourceTypes(new String[]{"webm", "mp4"}).videoTag("movie", emptyMap());
  assertEquals(expectedTag, actualTag);
}

相关文章