If you would like to allow users to first upload and crop an image via the upload widget. Then instead of uploading the same image let them re-edit. You can save the uploaded image as a variable and open it onclick.
var preWidget = cloudinary.createUploadWidget({
cropping: 'server',
upload_preset: upload_preset },
function(error, result) {
$("#open_pre_widget1").on("click", function() {
preWidget.open({file: result[0].secure_url});
});
});
Here is a sample code:
Comments
2 comments
Hi, Shirly Manor.
Thanks for this article.
Should it work in the same way?
Hi Marcio, version 2 of the widget introduced some architectural changes and indeed the code suggested above does not work with it. Try using the following -
Please sign in to leave a comment.