We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I Want to Preview the Bmp Picture,But Work Not .Why?Thanks.My Code Is:
function previewImage(file, callback) { if (!file || !/image\//.test(file.type)) return; if (file.type == 'image/gif') {//gif使用FileReader进行预览,因为mOxie.Image只支持jpg和png var fr = new mOxie.FileReader(); fr.onload = function () { callback(fr.result); fr.destroy(); fr = null; } fr.readAsDataURL(file.getSource()); } else { var preloader = new mOxie.Image(); preloader.onload = function () { preloader.downsize(300, 300); //先压缩一下要预览的图片,宽300,高300 var imgsrc = preloader.type == 'image/jpeg' ? preloader.getAsDataURL('image/jpeg', 80) : preloader.getAsDataURL(); //得到图片src,实质为一个base64编码的数据 callback && callback(imgsrc); //callback传入的参数为预览图片的url preloader.destroy(); preloader = null; }; preloader.load(file.getSource()); } }
The text was updated successfully, but these errors were encountered:
Currently only jpegs and pngs are considered to be images. Maybe its time to recap this.
Sorry, something went wrong.
you can change file.type ,for example
file.type
function previewImage(file, callback) { if (!file || !/image\//.test(file.type)) return; if (file.type == ('image/bmp' || 'image/gif') ) {//gif使用FileReader进行预览,因为mOxie.Image只支持jpg和png var fr = new mOxie.FileReader(); fr.onload = function () { callback(fr.result); fr.destroy(); fr = null; } fr.readAsDataURL(file.getSource()); } else { var preloader = new mOxie.Image(); preloader.onload = function () { preloader.downsize(300, 300); //先压缩一下要预览的图片,宽300,高300 var imgsrc = preloader.type == 'image/jpeg' ? preloader.getAsDataURL('image/jpeg', 80) : preloader.getAsDataURL(); //得到图片src,实质为一个base64编码的数据 callback && callback(imgsrc); //callback传入的参数为预览图片的url preloader.destroy(); preloader = null; }; preloader.load(file.getSource()); } }
No branches or pull requests
I Want to Preview the Bmp Picture,But Work Not .Why?Thanks.My Code Is:
The text was updated successfully, but these errors were encountered: