jquery - Change the preview image size image upload in JavaScript -
I started learning JS, so I borrowed online. I tried to modify my requirement in the suite, so I have two upload buttons with a preview that works properly, but the image image I am trying to get, the dimensions of the preview image after uploading Have to change Can anyone tell me where can I make that change?
HTML
& lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "jquery.image.upload.preview.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Upload (preview) ({callback: function (res) {res.after.empty ()) (res.img) {Res.after.append ($ ("<<"), $ ('&' Lt; img & gt; ', {"Src": res.img.src, "width": (res.img.width> 200)? "200": res.img.width}))}}} })}) & Lt; / Script & gt; & Lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "jquery.image.upload.preview.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Upload (preview) ($ callback: function (res1) {res1.after.empty ()) if (res1.img) {Res1.after.append ($ ("<<"), $ (' & Lt; img & gt; ', {"Src": res1.img.src, "width": (res1.img.width> 200)? "100": res1.img.width}))}} }}}}) & Lt; / Script & gt;
and JS file
(function () {var __indexOf = [] .indexOf || function {item} { (Var i = 0, l = this.length; i & lt; l; i ++) {If (I have this & amp; amp; i [= i] === item) return i;} return -1 ;}} ("{/} , [O]; ["every"] (function () {var, before, wrapper, wrap $ $ ("& lt; span & gt;"); $ (this) ["wrap"] (wrapper); $ ( $ & Amp;; & lt; span & gt;) = $ ("& lt; span & gt;") = $ ("& lt; span & gt; This (" First ") (First); $ ( Return; ("return") ("change", function () {var obj, reader, _ref; obj ["target"] = $ (this); Obj ["wrapper"] = cover; obj ["first"] = first; after obj ["after"] =; if (this.files and this.files [0] and amp; (_ref = This.files [0]. Type, __indexOf.call (O. type, _RF)> = 0)) {reader = new FileReader (); reader.odo = function (e) {var img; img = New image (); img.load = function () {returns o ["callback"] (obje); }; Img.src = e.target.result; Return obj ["img"] = img; }; Return Reader ReadAsDataURL (this.files [0]); } Other {Returns O ["Callback"] (OBJ); }}); }); $ (This) ["trigger"] ("change"); This return; }; This return; }) (JQuery); .}) Call (this);
Comments
Post a Comment