Closed xiaoyuit closed 7 years ago
How big is the file that you are trying to preview?
100M or so
Can you put that image somewhere? I will troubleshoot it. But to be honest it might easily be hitting browsers limits there.
Here is the picture address
https://lxyit.com/image.jpg
May I ask if this problem can be solved?
My temporary solution now:
function getObjectURL(file) {
var url = null ;
if (window.createObjectURL!=undefined) { // basic
url = window.createObjectURL(file) ;
} else if (window.URL!=undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file) ;
} else if (window.webkitURL!=undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file) ;
}
return url ;
}
function previewImage(file, callback) {
if (!file || !/image\//.test(file.type)) return;
var strsrc=getObjectURL(file.getSource().getSource());
callback(strsrc);
}
@xiaoyuit what exactly your solution does and how it is supposed to ease your problem?
It took me forever to download that file, browser got halted even when trying to simply enlarge it, I guess no surprise that it has problems to convert it to dataUrl and then preview it.
If previewing a blob does solve the problem for you, you can bypass dataUrl (FileReader) step altogether, as our Image wrapper can load blobs directly. So consider something like this: http://play.plupload.com/5_J
window.URL.createObjectURL has a better performance than FileReader, especially in the big picture preview; when I preview my test images, improve the performance obviously, but there will still be 3 seconds Caton
My test picture is about 70M, so it will be slow when downloading. This test picture is the original picture of the panorama
There was a problem with fiddle url, try now.
Did the fiddle solve your problem?
Without solving my problem, I can preview normally when I select a small picture and cannot preview when selecting a large picture
Using this address to download pictures might be faster. The server bandwidth I had sent before was too small. If you test, you can download this picture
Ok, that image seems too big (13956x6978), internally there's a constraint on image supported dimensions 8192x8192, if either side of the image is bigger than that moxie.image.Image
will fire an error.
I need to reconsider that though, since modern browsers can handle higher dimensions.
How can I support this kind of picture and ensure better preview performance?
Preview generation for large images should be much faster now in 2.3.3. However in underlying Image handler there's still a built-in constraint of 8192x8192. However it can be worked around by manually enlarging the boundaries. Check this updated playground for reference: http://play.plupload.com/5__J_/2
Yes, the preview of the big picture has been much faster
When I preview the big picture browser will be suspended for a period of time, ask the problems to be resolved, the preview code is as follows: