首页 > 解决方案 > 从 cloudinary 上传图像时,如何返回 cloudinary 的响应?

问题描述

我已经将我的图像上传到 cloudinary,但我不知道如何获取响应并保存生成的 URL 值以便将其存储在我的数据库中。这是上传它的代码,它工作正常。

             MediaManager.get().upload(Uri.fromFile(filePath))
            .option("resource_type", "image")
            .option("folder", "FuegoSanto/avatar/")
            .option("use_filename", "true")
            //.option("public_id",  nombreImagen)
            .option("version","currentTimeMillis")
            .option("overwrite", true)
            .option("notification_url", "https://mysite.example.com/notify_endpoint")
            .dispatch();

这是期望的响应

                {
            public_id: 'sample',
            version: '1312461204',
            width: 864,
            height: 564,
            format: 'jpg',
            created_at: '2017-08-10T09:55:32Z',
            resource_type: 'image',
            tags: [], 
            bytes: 9597, 
            type: 'upload', 
            etag: 'd1ac0ee70a9a36b14887aca7f7211737', 
            url: 'http://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg',
            secure_url: 'https://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg',
            signature: 'abcdefgc024acceb1c1baa8dca46717137fa5ae0c3',
           original_filename: 'sample'
            }
            So the idea is to take the value URL and store it in database.

标签: javaandroidjsoncloudinary

解决方案


推荐阅读