Skip to content

Can't get the size of a gif image? #172

@burzum

Description

@burzum

Moxie doens't support reading of gif image sizes? The following code, used with plupload, returns always false for gif but works fine for png and jpg.

Please not that the gif I'm trying to use is an animated gif.

plupload.addFileFilter('min_img_resolution', function(maxRes, file, cb) {
	var self = this;
	var img = new window.moxie.image.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: 'Image should be at least ' + maxRes[0] + ' pixels wide.',
				file: file
			});
		}
		cb(result);
	}

	img.onload = function() {
		finalize(img.width >= maxRes[0] && img.height >= maxRes[1]);
	};

	img.onerror = function() {
		finalize(false);
	};

	img.load(file.getSource());
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions