【发布时间】:2016-07-10 19:17:36
【问题描述】:
我在植入未签名的上传图片 url recal 时遇到了一些问题,本页中提到的方式: http://cloudinary.com/documentation/java_image_upload
不适合我用来上传 unsigned unsigned 的方法:
@Override
protected Void doInBackground(String... params) {
Map config = new HashMap();
config.put("cloud_name", "we4x4");
Cloudinary cloudinary = new Cloudinary(config);
try {
cloudinary.uploader().unsignedUpload((""+ RealFilePath), "frtkzlwz",
Cloudinary.asMap( "tags", UserID,"resource_type", "auto"));
} catch (IOException e) {
e.printStackTrace();
progressDialog.setMessage("Error uploading file");
progressDialog.hide();
}
return null;
}
有人可以向我解释我如何以及在哪里编写代码来获取上传图像的地址和地址吗? 我正在使用安卓工作室。
我能够上传文件,并使用以下代码调用其地址,但是当我尝试将 .upload 替换为 .unsignedUpload 时,就像我之前使用的那样在没有完整配置的情况下上传时,语法会变成红色下划线?尝试了几种方法来修补它但不起作用?我会很感激一些关于正确语法的提示来实现这一点?
Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap(
"cloud_name", "we4x4",
"api_key", "xxxxxxxxxxxxx",
"api_secret", "xxxxxxxxxxxxxxxx"));
try{
Map result = cloudinary.uploader().upload("" + RealFilePath, ObjectUtils.asMap(
"tags", UserID));
uploadedContentURL = (String) result.get("url");
【问题讨论】: