Reputation: 341
i have some kind of issue implanting unsigned uploaded images url recal, the way it is mentioned in this page: http://cloudinary.com/documentation/java_image_upload
does not go well with the method i used to 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;
}
could someone explain to me how and where do i write the code to get and address of the uploaded images ? i am using android studio.
I was able to upload the a file, and recall its address using the following code, but when i try to substitute .upload with .unsignedUpload as i used before to upload without my full config, the syntax get underlined red ? tried several ways to patch it but not working ? i would appreciate some tips on the right syntax to achieve this ?
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");
Upvotes: 0
Views: 240
Reputation: 778
The unsigned_upload()
method expects the following attributes: file
, UploadPreset
& options
Map, unlike the upload()
api that doesn't require the uploadPreset
parameter.
However, both return a response from the server formed as JSONObject.
There you can find all the information required for generating the URL (e.g. public_id, format, version, etc.)
A code example is available here: https://github.com/cloudinary/cloudinary_java/blob/master/cloudinary-android-test/src/main/java/com/cloudinary/test/UploaderTest.java#L67
Upvotes: 1