【问题标题】:Flutter - Cloudinary how to get uploaded image url?Flutter - Cloudinary 如何获取上传的图片网址?
【发布时间】:2021-10-27 17:14:09
【问题描述】:

我正在将我的图片上传到 cloudinary

final res = await cloudinary.uploadFile(
        CloudinaryFile.fromFile(
          _pickedFile.path,
          folder: 'hello-folder',
          context: {
            'alt': 'Hello',
            'caption': 'An example image',
          },
        ),
      );
      print('my res *** $res');

上传图片后,它的打印分辨率 结果

my res *** {asset_id: adasdasdasdasd, public_id: hello-folder/asdasdasd, created_at: 2021-08-27 20:04:45.000Z, url: http://res.cloudinary.com/dqunmzmqo/image/upload/v1630094685/hello-folder/d2eoasynxhj5llhb1p9e.jpg, secure_url: https://res.cloudinary.com/dqunmzmqo/image/upload/v1630094685/hello-folder/d2eoasynxhj5llhb1p9e.jpg, original_filename: 6b81c53d-7602-4bea-9ea1-1eaef1491144, tags: [], context: {custom: {alt: Hello, caption: An example image}}}

我想从 res 变量中获取 url

【问题讨论】:

  • 我认为回复会像{"asset_id": "adasdasdasdasd",.......}。缺少双引号?

标签: flutter dart cloudinary


【解决方案1】:

致寻找正确答案的人

final res = await cloudinary.uploadFile(
        CloudinaryFile.fromFile(
          _pickedFile.path,
          folder: 'hello-folder',
          context: {
            'alt': 'Hello',
            'caption': 'An example image',
          },
        ),
      );
    

Try this print(res.secureUrl)

【讨论】:

  • 请在您的回答中提供更多详细信息。正如目前所写的那样,很难理解您的解决方案。
猜你喜欢
  • 2014-11-24
  • 2020-03-02
  • 1970-01-01
  • 2023-03-06
  • 1970-01-01
  • 2019-03-11
  • 1970-01-01
  • 2018-07-21
  • 2016-09-20
相关资源
最近更新 更多