Topic: Resizing large images such as panoramas
I'm using a custom widget based on the plupload core API. This resizes uploaded images to 1500px x 1500px to make the upload process easier for users. The runtime in use is normally html5.
I've just noticed that if an image file is particularly large (e.g. a panorama created on a phone) then the image is not actually resized, but the full size image is uploaded in chunks.
In moxie.js, there is a MAX_RESIZE_WIDTH and MAX_RESIZE_HEIGHT setting, set to 6500 in v2 and 8192 in v3. These settings are accompanied by a comment "virtual world will crash on you if image has a resolution higher than this".
The downsize function then includes this code:
// no way to reliably intercept the crash due to high resolution, so we simply avoid it
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
However, if I temporarily hack moxie.js to remove these lines of code, I've successfully uploaded a resized 9000+ pixel wide image. So my question is - is the check for maximum image size to avoid a crash when resizing actually needed anymore, or was it written to cope with bugs in a specific runtime (which might not apply to htm5, or may not even apply at all anymore)?