本文整理了Java中com.cloudinary.Url.clone()
方法的一些代码示例,展示了Url.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.clone()
方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:clone
暂无
代码示例来源:origin: cloudinary/cloudinary_java
private void appendVideoSources(StringBuilder html, String source, String sourceType) {
Url sourceUrl = this.clone();
if (this.sourceTransformation != null) {
Transformation transformation = this.transformation;
Transformation sourceTransformation = null;
if (this.sourceTransformation.get(sourceType) != null)
sourceTransformation = new Transformation(this.sourceTransformation.get(sourceType));
if (transformation == null) {
transformation = sourceTransformation;
} else if (sourceTransformation != null) {
transformation = transformation.chainWith(sourceTransformation);
}
sourceUrl.transformation(transformation);
}
String src = sourceUrl.format(sourceType).generate(source);
String videoType = sourceType;
if (sourceType.equals("ogv"))
videoType = "ogg";
String mimeType = "video/" + videoType;
html.append("<source src='").append(src).append("' type='").append(mimeType).append("'>");
}
代码示例来源:origin: com.cloudinary/cloudinary-core
private void appendVideoSources(StringBuilder html, String source, String sourceType) {
Url sourceUrl = this.clone();
if (this.sourceTransformation != null) {
Transformation transformation = this.transformation;
Transformation sourceTransformation = null;
if (this.sourceTransformation.get(sourceType) != null)
sourceTransformation = new Transformation(this.sourceTransformation.get(sourceType));
if (transformation == null) {
transformation = sourceTransformation;
} else if (sourceTransformation != null) {
transformation = transformation.chainWith(sourceTransformation);
}
sourceUrl.transformation(transformation);
}
String src = sourceUrl.format(sourceType).generate(source);
String videoType = sourceType;
if (sourceType.equals("ogv"))
videoType = "ogg";
String mimeType = "video/" + videoType;
html.append("<source src='").append(src).append("' type='").append(mimeType).append("'>");
}
代码示例来源:origin: com.cloudinary/cloudinary-core
public Url clone() {
Url cloned = cloudinary.url();
cloned.config.update(config.asMap());
cloned.fallbackContent = this.fallbackContent;
cloned.format = this.format;
cloned.posterSource = this.posterSource;
if (this.posterTransformation != null)
cloned.posterTransformation = new Transformation(this.posterTransformation);
if (this.posterUrl != null) cloned.posterUrl = this.posterUrl.clone();
cloned.publicId = this.publicId;
cloned.resourceType = this.resourceType;
cloned.signUrl = this.signUrl;
cloned.source = this.source;
if (this.transformation != null) cloned.transformation = new Transformation(this.transformation);
if (this.sourceTransformation != null) {
cloned.sourceTransformation = new HashMap<String, Transformation>();
for (Map.Entry<String, Transformation> keyValuePair : this.sourceTransformation.entrySet()) {
cloned.sourceTransformation.put(keyValuePair.getKey(), keyValuePair.getValue());
}
}
cloned.sourceTypes = this.sourceTypes;
cloned.urlSuffix = this.urlSuffix;
cloned.useRootPath = this.useRootPath;
return cloned;
}
代码示例来源:origin: cloudinary/cloudinary_java
public Url clone() {
Url cloned = cloudinary.url();
cloned.config.update(config.asMap());
cloned.fallbackContent = this.fallbackContent;
cloned.format = this.format;
cloned.posterSource = this.posterSource;
if (this.posterTransformation != null)
cloned.posterTransformation = new Transformation(this.posterTransformation);
if (this.posterUrl != null) cloned.posterUrl = this.posterUrl.clone();
cloned.publicId = this.publicId;
cloned.resourceType = this.resourceType;
cloned.signUrl = this.signUrl;
cloned.source = this.source;
if (this.transformation != null) cloned.transformation = new Transformation(this.transformation);
if (this.sourceTransformation != null) {
cloned.sourceTransformation = new HashMap<String, Transformation>();
for (Map.Entry<String, Transformation> keyValuePair : this.sourceTransformation.entrySet()) {
cloned.sourceTransformation.put(keyValuePair.getKey(), keyValuePair.getValue());
}
}
cloned.sourceTypes = this.sourceTypes;
cloned.urlSuffix = this.urlSuffix;
cloned.useRootPath = this.useRootPath;
return cloned;
}
代码示例来源:origin: com.cloudinary/cloudinary-core
private String finalizePosterUrl(String source) {
String posterUrl = null;
if (this.posterUrl != null) {
posterUrl = this.posterUrl.generate();
} else if (this.posterTransformation != null) {
posterUrl = this.clone().format("jpg").transformation(new Transformation(this.posterTransformation))
.generate(source);
} else if (this.posterSource != null) {
if (!StringUtils.isEmpty(this.posterSource))
posterUrl = this.clone().format("jpg").generate(this.posterSource);
} else {
posterUrl = this.clone().format("jpg").generate(source);
}
return posterUrl;
}
代码示例来源:origin: cloudinary/cloudinary_java
private String finalizePosterUrl(String source) {
String posterUrl = null;
if (this.posterUrl != null) {
posterUrl = this.posterUrl.generate();
} else if (this.posterTransformation != null) {
posterUrl = this.clone().format("jpg").transformation(new Transformation(this.posterTransformation))
.generate(source);
} else if (this.posterSource != null) {
if (!StringUtils.isEmpty(this.posterSource))
posterUrl = this.clone().format("jpg").generate(this.posterSource);
} else {
posterUrl = this.clone().format("jpg").generate(source);
}
return posterUrl;
}
代码示例来源:origin: cloudinary/cloudinary_android
/**
* Construct the final url with the dimensions included as the last transformation in the url.
* @param view The view to adapt the image size to.
* @param baseUrl The base cloudinary Url to chain the transformation to.
* @return The url with the responsive transformation.
*/
private Url buildUrl(View view, Url baseUrl) {
// add a new transformation on top of anything already there:
Url url = baseUrl.clone();
url.transformation().chain();
if (autoHeight) {
int contentHeight = view.getHeight() - view.getPaddingTop() - view.getPaddingBottom();
url.transformation().height(trimAndRoundUp(contentHeight));
}
if (autoWidth) {
int contentWidth = view.getWidth() - view.getPaddingLeft() - view.getPaddingRight();
url.transformation().width(trimAndRoundUp(contentWidth));
}
url.transformation().crop(cropMode).gravity(gravity);
return url;
}
代码示例来源: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());
}
}
内容来源于网络,如有侵权,请联系作者删除!