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

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

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

Url.generate介绍

暂无

代码示例

代码示例来源:origin: com.cloudinary/cloudinary

public String generateSpriteCss(String source) {
  this.type = "sprite";
  if (!source.endsWith(".css")) this.format = "css";
  return generate(source);		
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public String generateSpriteCss(String source) {
  this.type = "sprite";
  if (!source.endsWith(".css"))
    this.format = "css";
  return generate(source);
}

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

@Override
  public void onUrlReady(Url url) {
    Picasso.get().load(url.generate()).placeholder(placeholder).into(holder.imageView);
  }
});

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

@Override
  public void onUrlReady(Url url) {
    String urlString = url.generate();
    currentUrl = urlString;
    MediaSource videoSource = new ExtractorMediaSource(Uri.parse(urlString), dataSourceFactory, extractorsFactory, null, null);
    exoPlayer.addListener(listener);
    exoPlayer.prepare(videoSource);
  }
});

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

public void doTag() throws JspException, IOException {
  JspWriter out = getJspContext().getOut();
  Url url = this.prepareUrl();
  out.println(url.generate());
}

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

@Test
public void testIgnoreHttp() {
  // should ignore http links only if type is not given or is asset
  String result = cloudinary.url().generate("http://test");
  assertEquals("http://test", result);
  result = cloudinary.url().type("asset").generate("http://test");
  assertEquals("http://test", result);
  result = cloudinary.url().type("fetch").generate("http://test");
  assertEquals("http://res.cloudinary.com/test123/image/fetch/http://test", result);
}

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

@Test
public void testCloudName() {
  // should use cloud_name from config
  String result = cloudinary.url().generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "test", result);
}

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

@Test
public void testType() {
  // should use type from options
  String result = cloudinary.url().type("facebook").generate("test");
  assertEquals("http://res.cloudinary.com/test123/image/facebook/test", result);
}

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

@Test
public void testHttpEscape() {
  // should escape http urls
  String result = cloudinary.url().type("youtube").generate("http://www.youtube.com/watch?v=d9NF2edxy-M");
  assertEquals("http://res.cloudinary.com/test123/image/youtube/http://www.youtube.com/watch%3Fv%3Dd9NF2edxy-M", result);
}

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

@Test
public void testFormat() {
  // should use format from options
  String result = cloudinary.url().format("jpg").generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "test.jpg", result);
}

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

@Test
public void testShorten() {
  // should allow to shorted image/upload urls
  String result = cloudinary.url().shorten(true).generate("test");
  assertEquals("http://res.cloudinary.com/test123/iu/test", result);
}

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

@Test
public void testSupportUrlSuffixForPrivateCdn() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/test/hello", actual);
  actual = cloudinary.url().suffix("hello").privateCdn(true).transformation(new Transformation().angle(0)).generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/a_0/test/hello", actual);
}

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

@Test
public void testSupportUrlSuffixForVideoUploads() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).resourceType("video").generate("test");
  assertEquals("http://test123-res.cloudinary.com/videos/test/hello", actual);
}

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

@Test
public void testSupportUseRootPathForPrivateCdn() {
  String actual = cloudinary.url().privateCdn(true).useRootPath(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/test", actual);
  actual = cloudinary.url().privateCdn(true).transformation(new Transformation().angle(0)).useRootPath(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/a_0/test", actual);
}

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

@Test
public void testSupportUseRootPathTogetherWithUrlSuffixForPrivateCdn() {
  String actual = cloudinary.url().privateCdn(true).suffix("hello").useRootPath(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/test/hello", actual);
}

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

@Test
public void testEffectWithParam() {
  // should support effect with param
  Transformation transformation = new Transformation().effect("sepia", 10);
  String result = cloudinary.url().transformation(transformation).generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "e_sepia:10/test", result);
}

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

@Test
public void testDensity() {
  // should support density
  Transformation transformation = new Transformation().density(150);
  String result = cloudinary.url().transformation(transformation).generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "dn_150/test", result);
}

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

@Test
public void testPutFormatAfterUrlSuffix() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).format("jpg").generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/test/hello.jpg", actual);
}

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

@Test
  public void testUrlCloneConfig(){
    // verify that secure (from url.config) is cloned as well:
    Url url = cloudinary.url().cloudName("cloud").format("frmt").publicId("123").secure(true);
    assertEquals("https://res.cloudinary.com/cloud/image/upload/123.frmt", url.clone().generate());
  }
}

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

@Test
public void testCrop() {
  Transformation transformation = new Transformation().width(100).height(101);
  String result = cloudinary.url().transformation(transformation).generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "h_101,w_100/test", result);
  assertEquals("101", transformation.getHtmlHeight());
  assertEquals("100", transformation.getHtmlWidth());
  transformation = new Transformation().width(100).height(101).crop("crop");
  result = cloudinary.url().transformation(transformation).generate("test");
  assertEquals(DEFAULT_UPLOAD_PATH + "c_crop,h_101,w_100/test", result);
}

相关文章