本文整理了Java中com.cloudinary.Url.imageTag()
方法的一些代码示例,展示了Url.imageTag()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.imageTag()
方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:imageTag
暂无
代码示例来源:origin: com.cloudinary/cloudinary
public String imageTag(String source, Map<String, String> attributes) {
this.source = source;
return imageTag(attributes);
}
代码示例来源:origin: com.cloudinary/cloudinary-core
public String imageTag(Map<String, String> attributes) {
return imageTag(null, attributes);
}
代码示例来源:origin: cloudinary/cloudinary_java
public String imageTag(Map<String, String> attributes) {
return imageTag(null, attributes);
}
代码示例来源:origin: com.cloudinary/cloudinary
public String imageTag(StoredFile source, Map<String, String> attributes) {
source(source);
return imageTag(attributes);
}
代码示例来源:origin: cloudinary/cloudinary_java
@SuppressWarnings("unchecked")
public String imageTag(String source) {
return imageTag(source, ObjectUtils.emptyMap());
}
代码示例来源:origin: com.cloudinary/cloudinary
public String imageTag(String source) {
return imageTag(source, Cloudinary.emptyMap());
}
代码示例来源:origin: com.cloudinary/cloudinary-core
@SuppressWarnings("unchecked")
public String imageTag(String source) {
return imageTag(source, ObjectUtils.emptyMap());
}
代码示例来源:origin: com.cloudinary/cloudinary
public String imageTag() {
return imageTag(Cloudinary.emptyMap());
}
代码示例来源:origin: com.cloudinary/cloudinary
public String imageTag(StoredFile source) {
return imageTag(source, Cloudinary.emptyMap());
}
代码示例来源:origin: cloudinary/cloudinary_java
public void doTag() throws JspException, IOException {
JspWriter out = getJspContext().getOut();
Url url = this.prepareUrl();
out.println(url.imageTag(prepareAttributes()));
}
代码示例来源:origin: cloudinary/cloudinary_java
@Test
public void testClientHints() {
String testTag;
String message = "should not implement responsive behaviour if client hints is true";
cloudinary.config.clientHints = true;
Transformation trans = new Transformation()
.crop("scale")
.width("auto")
.dpr("auto");
testTag = cloudinary.url().transformation(trans).imageTag("sample.jpg");
assertTrue(testTag.startsWith("<img"));
assertFalse(message, testTag.contains("class="));
assertFalse(message, testTag.contains("data-src"));
assertTrue(message, testTag.contains("src='http://res.cloudinary.com/test123/image/upload/c_scale,dpr_auto,w_auto/sample.jpg'"));
testTag = cloudinary.url().transformation(trans).imageTag("sample.jpg");
assertTrue(testTag.startsWith("<img"));
assertFalse(testTag.contains("class="));
assertFalse(message, testTag.contains("data-src"));
assertTrue(message, testTag.contains("src='http://res.cloudinary.com/test123/image/upload/c_scale,dpr_auto,w_auto/sample.jpg'"));
}
代码示例来源:origin: cloudinary/cloudinary_java
@Test
public void testUrlInTag() {
String message = "should add token to an image tag url";
String url = cloudinary.url().signed(true).resourceType("image").type("authenticated").version("1486020273").imageTag("sample.jpg");
assertThat(url, Matchers.matchesPattern("<img.*src='http://res.cloudinary.com/test123/image/authenticated/v1486020273/sample.jpg\\?__cld_token__=st=11111111~exp=11111411~hmac=9bd6f41e2a5893da8343dc8eb648de8bf73771993a6d1457d49851250caf3b80.*>"));
}
}
代码示例来源:origin: cloudinary/cloudinary_java
@SuppressWarnings("unchecked")
@Test
public void testImageTag() {
Transformation transformation = new Transformation().width(100).height(101).crop("crop");
String result = cloudinary.url().transformation(transformation).imageTag("test", asMap("alt", "my image"));
assertEquals("<img src='http://res.cloudinary.com/test123/image/upload/c_crop,h_101,w_100/test' alt='my image' height='101' width='100'/>", result);
transformation = new Transformation().width(0.9).height(0.9).crop("crop").responsiveWidth(true);
result = cloudinary.url().transformation(transformation).imageTag("test", asMap("alt", "my image"));
assertEquals(
"<img alt='my image' class='cld-responsive' data-src='http://res.cloudinary.com/test123/image/upload/c_crop,h_0.9,w_0.9/c_limit,w_auto/test'/>",
result);
result = cloudinary.url().transformation(transformation).imageTag("test", asMap("alt", "my image", "class", "extra"));
assertEquals(
"<img alt='my image' class='extra cld-responsive' data-src='http://res.cloudinary.com/test123/image/upload/c_crop,h_0.9,w_0.9/c_limit,w_auto/test'/>",
result);
transformation = new Transformation().width("auto").crop("crop");
result = cloudinary.url().transformation(transformation).imageTag("test", asMap("alt", "my image", "responsive_placeholder", "blank"));
assertEquals(
"<img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' alt='my image' class='cld-responsive' data-src='http://res.cloudinary.com/test123/image/upload/c_crop,w_auto/test'/>",
result);
result = cloudinary.url().transformation(transformation).imageTag("test", asMap("alt", "my image", "responsive_placeholder", "other.gif"));
assertEquals(
"<img src='other.gif' alt='my image' class='cld-responsive' data-src='http://res.cloudinary.com/test123/image/upload/c_crop,w_auto/test'/>",
result);
}
内容来源于网络,如有侵权,请联系作者删除!