Skip to main content

Can I use the upload widget to re-edit the uploaded image?

Comments

2 comments

  • Marcio Ber

    Hi, Shirly Manor.

    Thanks for this article.

    I can't make it work for Widget V2.

    Should it work in the same way?

     

    0
  • Eyal Katz Talmon

    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 -

    var cloud_name = '<cloud-name>';
    var upload_preset = '<preset>';

    cloudinary.setCloudName(cloud_name);

    var preWidget = cloudinary.createUploadWidget({
       cropping: 'server',
       upload_preset: upload_preset
    }, function(error, result) {
    if (result.event === "success") {
        $("#open_pre_widget1").on("click", function() {
            preWidget.open(null, {files: [result.info.secure_url]});
        });
       }
    });

    $("#open_pre_widget0").on("click", function() {
       preWidget.open();
    });
    0

Please sign in to leave a comment.