MWeb 使用 Cloudinary 图床

注册

访问 https://cloudinary.com/users/register/free 注册账号。

Assigned cloud name

记住 Assigned cloud name 或自定义。

Cloudinary 设置

访问 https://cloudinary.com/console/settings/upload 添加 Upload preset

Add upload preset

记住 Upload preset name 或自定义,修改 Signing ModeUnsigned,自定义 Folder 为上传文件夹,最后点击 Save 保存。

Upload preset

访问 https://cloudinary.com/console 查看 API Base URL

API Base URL

MWeb 配置

基本信息:

  1. 名称:Cloudinary
  2. API 地址:${API Base URL}/image/upload
  3. POST 文件名:file
  4. 图片 URL 路径:secure_url

增加两个 POST BODY 字段:

  1. upload_preset${Upload preset name}
  2. tagsbrowser_upload

MWeb

最后验证一下配置是否正确。

访问 https://cloudinary.com/console/media_library/folders/all/ 后台可以看到刚刚上传的图片。

说明

上传接口请求参数

查看 https://cloudinary.com/documentation/upload_images#uploading_with_a_direct_call_to_the_api

在线例子:https://codepen.io/team/Cloudinary/pen/QgpyOK

Required parameters for unauthenticated requests

上传接口返回参数

查看 https://cloudinary.com/documentation/upload_images#upload_response

Upload response