exif-js / exif-js

JavaScript library for reading EXIF image metadata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

input:multiple → file data missing in results

murimere opened this issue · comments

Great work! Many Thanks!

The exif.js seems to be for single images only. This concerns especially the function using input type:file multiple. When reading the Exif data of multiple photos, the file datas are missing (filename, width, height, ...). The problem is that exif.js is asynchronous in a for loop and thus not synchronous with the reading/collection of the file data to create an array.

The problem can be solved by including the file data in the results.

EXIF.getAllTags = function(img) {
	if (!imageHasData(img)) return {};
	var a,
		data = img.exifdata,
		tags = {};
	for (a in data) {
		if (data.hasOwnProperty(a)) {
			tags[a] = data[a];
		}
	}
// --- MODDING --- BEGIN
	tags["imageelement"] = img;
// --- MODDING --- END
	return tags;
}