gpt4 book ai didi

jquery - 使用 jQuery 使用 Cloudinary API 直接上传图像

转载 作者:行者123 更新时间:2023-12-01 03:34:58 37 4
gpt4 key购买 nike

我正在尝试使用 jQuery 使用 Cloudinary 图像上传 API 上传图像。我对此一无所知。我正在使用以下代码。我不知道我们在签名参数中使用什么值。

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="js/jquery.ui.widget.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script src="js/jquery.cloudinary.js"></script>
</head>
<body>
<script type="text/javascript">
$.cloudinary.config({"api_key":"api_key","cloud_name":"cloud_name"});
</script>
<input name="file" type="file" id="uploadinput"
class="cloudinary-fileupload" data-cloudinary-field="image_upload"
data-form-data="" ></input>
<script>
var data = { "timestamp": '',
"callback": "http//localhost/cloudinar/index.php?message='file has been uploaded'",
"signature": "",
"api_key": "api_key" };
$('#uploadinput').attr('data-form-data', JSON.stringify(data));
</script>
</body>
</html>

最佳答案

与支持人员交谈后,我被引导至 this post ,它展示了如何使用“unsigned”方法将文件直接上传到Cloudinary,尽可能简单:

$('.upload_field').unsigned_cloudinary_upload("zcudy0uz", 
{ cloud_name:'demo', tags:'browser_uploads' },
{ multiple:true }
)
.on('cloudinarydone', function(e, data){
var opts = {
format : 'jpg',
width : 150,
height : 100,
crop : 'thumb',
gravity : 'face',
effect : 'saturation:50'
};

$('.thumbnails').append( $.cloudinary.image(data.result.public_id, opts) )
})
.on('cloudinaryprogress', function(e, data){
var W = Math.round((data.loaded * 100.0) / data.total) // %
$('.progress_bar').css('width', W + '%');
});

我还获得了 demo page由一位名叫“Maor Gariv”的人回复了我的支持电子邮件。

关于jquery - 使用 jQuery 使用 Cloudinary API 直接上传图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37204810/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com