javascript - Issue with stock Browser picking photos from Gallery -


i working on web page uploading photos mobile device, using <input type="file" accept="image/*"/> tag. works beautifully on iphone , on chrome on android, running issues stock android browser.

the issue arises when select file gallery (it works fine when use camera take photo). , have narrowed down further seeing data mime type isn't available when taken gallery on stock browser (the photos below show first 100 characters of data url being loaded. goal force jpeg, without mime type cannot know sure how fix this. see code below how images being rendered.

how can image rendered without type? better yet, know why type not available on stock android browser?

edit

firstly, these not same image, taken near same time, , that's not issue, that's why data different (the mime type doesn't appear on images on stock browser, that's not problem.

update

i confirmed mime type issue inserting image/jpeg stock browser on chrome. unfortunately, have no way of guaranteeing it's going jpeg, again can't way

 _readinputfile: function (file, index) {             var w = this, o = this.options;             try {                  var filereader = new filereader();                  filereader.onerror = function (event) {                     alert(w._translate("there problem opening selected file. mobile devices, files created third-party applications (those did not ship device) may not standard , cannot used."))                     $('#loadingdots').remove();                     return false;                 }                filereader.onload = function (event) {                  var data = event.target.result;                 //alert(data.substring(0,100));                 //var mimetype = data.split(":")[1].split(";")[0];                   alert("load image"); //i point                 $('#' + w.disp.idprefix + 'hiddenimages').append($('<img />', {                     src: data,                     id: "dummyimg" + index,                     load: function(){                     var width = dummy.width();                     var height = dummy.height();                     $('#dummyimg' + index).remove();                     alert("render"); // don't here                         var resized = w._resizeandrenderimage(data, null, null, biosbugfixrequired, skewratio, width, height);                         alert("image rendered"); // don't here                      }                 }));             }             filereader.readasdataurl(file);         }         catch (e) {         }    }  

chrome
chrome

stock browser
stock browser

since issue browser-related, , can't fix browser(you report bug google though), i'd suggest taking different path.

have here: in node.js, given url, how check whether jpg/png/gif?

see comments of accepted answer, suggests method check file type using file stream. i'm pretty sure work on browser-implemented javascript , not in node.js.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -