Skip to content

Commit bc6ffe7

Browse files
committed
v2.1.1
上传返回结果里增加原图的width和height。
1 parent f06d58f commit bc6ffe7

15 files changed

+198
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Demo
7676

7777
版本信息
7878
-----------------------------------
79+
### v2.1.1
80+
上传返回结果里增加原图的width和height。
81+
7982
### v2.1.0
8083
重新规范化sdk代码,不兼容以前版本。
8184
重载upload接口,增加nputStream的输入方式。

src/main/java/com/qcloud/PicCloud.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ public int upload(InputStream inputStream, String fileId, PicAnalyze flag, Uploa
238238
result.fileId = jsonObject.getJSONObject("data")
239239
.getString("fileid");
240240

241+
if(jsonObject.getJSONObject("data").has("info") &&
242+
jsonObject.getJSONObject("data").getJSONArray("info").length() > 0 ){
243+
result.width = jsonObject.getJSONObject("data").getJSONArray("info").getJSONObject(0).getJSONObject("0").getInt("width");
244+
result.height = jsonObject.getJSONObject("data").getJSONArray("info").getJSONObject(0).getJSONObject("0").getInt("height");
245+
}
246+
241247
if(jsonObject.getJSONObject("data").has("is_fuzzy")){
242248
result.analyze.fuzzy = jsonObject.getJSONObject("data").getInt("is_fuzzy");
243249
}
@@ -405,6 +411,13 @@ public int copy(String fileId, UploadResult result) {
405411
"download_url");
406412
result.fileId = result.url
407413
.substring(result.url.lastIndexOf('/') + 1);
414+
415+
if(jsonObject.getJSONObject("data").has("info") &&
416+
jsonObject.getJSONObject("data").getJSONArray("info").length() > 0 ){
417+
result.width = jsonObject.getJSONObject("data").getJSONArray("info").getJSONObject(0).getJSONObject("0").getInt("width");
418+
result.height = jsonObject.getJSONObject("data").getJSONArray("info").getJSONObject(0).getJSONObject("0").getInt("height");
419+
}
420+
408421
} catch (JSONException e) {
409422
return setError(-1, "json exception, e=" + e.toString());
410423
}

src/main/java/com/qcloud/UploadResult.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ public class UploadResult {
1313
public String url; // 资源url
1414
public String downloadUrl; // 下载url
1515
public String fileId; // 资源的唯一标识
16-
public String coverUrl; // 视频资源的封面url,只有转码过的视频才有,默认是黑屏后的第一帧
16+
public int width;
17+
public int height;
1718
public PicAnalyze analyze; //图片分析的结果
1819

1920
public UploadResult() {
2021
url = "";
2122
downloadUrl = "";
2223
fileId = "";
23-
coverUrl = "";
24+
width = 0;
25+
height = 0;
2426
analyze = new PicAnalyze();
2527
}
2628

2729
public void print() {
2830
System.out.println("url = " + url);
2931
System.out.println("downloadUrl = " + downloadUrl);
3032
System.out.println("fileId = " + fileId);
31-
if (coverUrl.length() > 0) {
32-
System.out.println("coverUrl = " + coverUrl);
33-
}
33+
System.out.println("width = " + width);
34+
System.out.println("height = " + height);
3435
}
3536
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Generated by Maven
2+
#Wed Sep 23 15:43:40 CST 2015
3+
version=2.1.1
4+
groupId=com.qcloud
5+
artifactId=qcloud-sdk
-70.5 KB
Binary file not shown.
-8.75 KB
Binary file not shown.

target/qcloud-sdk-2.1.0.jar

-15.3 KB
Binary file not shown.
70.5 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN PGP SIGNATURE-----
2+
Version: GnuPG v1.4.13 (MingW32)
3+
4+
iQEcBAABAgAGBQJWAlgxAAoJEB7qeWRJvIv0AMMIAI2gbmmYcOFvmifyBjzSmw9v
5+
Mk6+P20ylGy/aJ7EWETEaT3z6Mpgi/UAFVVcuHcv2XrM+q4wM1oeBSXNiM5m7Rot
6+
JdP4czzbLw9Qrb1z4uz8aNlpCWJ7s3Wzu8jJS7kBHSgi3VdqiQ1hSWvHnDAm5gJs
7+
ZigOrd/56kN722PFwxENmTiQRgOzGHtUIPC3MfLUI08EkDesNAytkEEca8sHk3gO
8+
CAVyTXQ0gjMFLjZQ56ZHxFDdBrSsbqYMwe5vIavP9z684ZJ8sjNWBhY08woK0tOW
9+
gEzm4ubltPWXGjeyEncAymKckm7NMt/j+6NIaKnFV4xgkCTsRNDFrJVEjp79UJ4=
10+
=B6uf
11+
-----END PGP SIGNATURE-----
8.79 KB
Binary file not shown.

0 commit comments

Comments
 (0)