0

i have a little problem, i'using jquery plugin for crop and uploading images.. here is a code

$("#file").change(function(e) {

    var file, img;

    if ((file = this.files[0])) {
        img = new Image();
        img.onload = function() {
        $(".cropit-preview").show();
        };
        img.onerror = function() {
            alert( "not a valid file: " + file.type);
        };
        img.src = _URL.createObjectURL(file);
    }
});

The above code working perfectly and after click on input button it shows me preview of the image with croping option and after croping it's create image base64 code .. Now i want user can add image using url after input url, same process will repeat but i don't know how to draw image to show preview

Steve Smith
  • 2,244
  • 2
  • 18
  • 22
Joe
  • 57
  • 1
  • 9
  • Or https://stackoverflow.com/questions/39592752/read-image-from-url-upload – CBroe Jul 14 '17 at 11:43
  • Be aware though that this will only work if the site you want to load images from explicitly allows this (keyword: “tainted canvas”) - if they don’t, then you can not do this using client-side JavaScript alone. – CBroe Jul 14 '17 at 11:44

0 Answers0