Rename image before uploading using jQuery
Is there a way by which I can rename and cutomize the name given to the image before uploading it. I am using jQuery for uploading. Is there a method from where I can manipulate image name and then upload.
Below is the implemented code. I am a newbie to cloudinary, and exploring it right now.
$(document).ready(function(){
$(".cloudinary-fileupload").each(function() {
var datas = $(this).cloudinary_fileupload({
formData: {
upload_preset: preset_name
}
});
//Thumbnails preview
$(this).bind("cloudinarydone", function (e, data) {
$('.thumbnails').append($.cloudinary.image(data.result.public_id, {
format: 'jpg',
width: 150,
height: 100,
crop: 'thumb',
//gravity: 'face',
effect: 'sharpen:300'
}))
});
//Progress Bar while uploading images
$(this).bind("cloudinaryprogress", function (e, data) {
var percent = Math.round((data.loaded * 100.0) / data.total);
$('.progress_bar').css('width', percent + '%');
$('.progress_wrapper .text').text(percent + '%');
});
});
});
-
Hi Abhishek,
You can access the image by referring to the public_id, for example, the image from above would be referred to as "my_image".
You can read on the following link on how to apply image transformations - http://cloudinary.com/documentation/image_transformations
Hope this helps, please let me know if you need anything else.
Raya
Post is closed for comments.
Comments
4 comments