addFileFilter - 'max_img_resolution' not working on GIF files
Hi,
I am using plupload to upload images and used the addFileFilter function to restrict image dimensions. It is working well with JPGs and PNGs but not with GIFs.
I used the exact same code to implement the filtering found here.
But for some reason when uploading gif files, it always raises the onerror event.
Any ideas why?
Thank you!
hi, I used max_img_resolution , but i got an error: o is not defined, did you got that?
plupload.addFileFilter('max_img_resolution', function(maxRes, file, cb) { var self = this, img = new o.Image();
function finalize(result) {
// cleanup
img.destroy();
img = null;
// if rule has been violated in one way or another, trigger an error
if (!result) {
self.trigger('Error', {
code : plupload.IMAGE_DIMENSIONS_ERROR,
message : "Resolution exceeds the allowed limit of " + maxRes + " pixels.",
file : file
});
}
cb(result);
}
img.onload = function() {
// check if resolution cap is not exceeded
finalize(img.width * img.height < maxRes);
};
img.onerror = function() {
finalize(false);
};
img.load(file.getSource());
});
GIFs are not being considered images by Plupload, only JPEGs and PNGs.
@CandiceCaiYu same error, do you fix it?
I got the same error