Plupload Html5 preview after Fileselect

情到浓时终转凉″ 提交于 2019-12-03 04:17:00

Plupload 2 has an image object, which you can use: https://github.com/moxiecode/moxie/wiki/Image

File.getSource() and mOxie.Image.embed() are the methods, you are interested in.

https://github.com/moxiecode/plupload/wiki/File#wiki-getSource--method

https://github.com/moxiecode/moxie/wiki/Image#wiki-embed-eloptions-method

The jQuery UI queue widget uses this.

Here's a working example for a custom uploader: http://jsfiddle.net/Ec3te/2/

Works even in browsers that don't support HTML5 File API (yes, even IE6).

Make Web

function showImagePreview( file ) {
	var reader = new window.FileReader();
	reader.readAsDataURL(file.getNative());
	reader.onload = function () {
		base64data = reader.result;
		base64data = base64data.substring(base64data.indexOf(",") + 1);
	  var base_64_url = "data:" + file.type + ";base64," + base64data;
	}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Alternative showImagePreview (Withour mOxie)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!