I am trying to upload images using Cloudinary image upload API using jQuery. I have no idea about it. I am using the following code. and I dont know what value do we use in signature parameter.
<!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>
After talking with support I was directed to this post, which shows how to upload files directly to Cloudinary, as simple as possible, with "unsigned" method:
$('.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 + '%');
});
I was also given a demo page by a person named "Maor Gariv" who answered my support email.
Cloudinary's server-side SDKs support automatically generating an input field which automatically includes the corresponding signature. For more information (e.g., with PHP): http://cloudinary.com/documentation/php_image_upload#direct_uploading_from_the_browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With