Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

moxie能够生成视频地址吗?

previewImage: function (file, callback) {
  if (!file || !/image//.test(file.type)) return;// 确保文件是图片
 // gif使用FileReader进行预览,因为moxie.image.Image只支持jpg和png
 if (file.type === 'image/gif') {
    let fr = new moxie.file.FileReader();
 fr.onload = function () {
      callback(fr.result);
 fr.destroy();
 fr = null;
 }
    fr.readAsDataURL(file.getSource());
 } else {
    let preloader = new moxie.image.Image();
 preloader.onload = function () {
      preloader.downsize(120, 100);// 先压缩一下要预览的图片
 // 得到图片src,实质为一个base64编码的数据
 let imgSrc = preloader.type === 'image/jpeg' ? preloader.getAsDataURL('image/jpeg', 80) : preloader.getAsDataURL();
 callback && callback(imgSrc);
 preloader.destroy();
 preloader = null;
 };
 preloader.load(file.getSource());
 }
},

这个方法能够将plupload出来来的图片生成一个图片地址来提供预览。
所以它能够将传过来的文件生成一个视频地址吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

没有人来嘛?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...