将base64哈希图像上传到Cloudinary

时间:2014-06-03 12:13:47

标签: php base64 cloudinary

有没有办法将图像作为base64哈希上传到Cloudinary?我找不到PHP上传器库的参数。

Cloudinary's upload API call accepts the following options:

file - The resource to upload. Can be one of the following:
A local path (e.g., '/home/my_image.jpg').
An HTTP URL of a resource available on the Internet (e.g., 'http://www.example.com/image.jpg').
A URL of a file in a private S3 bucket white-listed for your account (e.g., 's3://my-bucket/my-path/my-file.jpg')

在这里说:http://cloudinary.com/documentation/php_image_upload

1 个答案:

答案 0 :(得分:2)

Cloudinary支持使用映像的base64编码数据上传文件。 您应该确保将内容作为数据URI发送,如下所述:http://en.wikipedia.org/wiki/Data_URI_scheme

例如在PHP中:

\Cloudinary\Uploader::upload("data:image/jpeg;base64...")