I'm using for file-input preview bootstrap-fileinput.js by Arnold Daniels. And for cropping jquery.Jcrop.js by Kelly Hallman.
bootstrap-fileinput for live-preview just selected image, insert in image src encoded data URL. Something like this data:image/png;base64,iVBORw.......
So, i wanted when user select photo, and get it live-preview, to allow them crop that image. I tryed to do that with additional button: When user choosed image, get live-preview, and when click on button "crop", then for just added image will initialized Jcrop script. ($img_wrapper.find('img').Jcrop({});). And it's work, all fine.
But when i try to do same, without pressing "crop" button, but automatically after file selected, it's dont work, cause how i understood, jQuery dont see new image. I tryed with event on.('click', func... and it's dont work. Then i found in documentation (http://ift.tt/1vp18Kg) that Jcrop provides her own listener on.('change.bs.fileinput', funct... but it still does not work. So with button "crop" work fine, automatically dont work, why? :/
Aucun commentaire:
Enregistrer un commentaire