Comparing version 2.2.3 to 2.3.0
52
exif.js
@@ -371,7 +371,9 @@ (function() { | ||
var data = findEXIFinJPEG(binFile); | ||
img.exifdata = data || {}; | ||
var iptcdata = findIPTCinJPEG(binFile); | ||
var xmpdata= findXMPinJPEG(binFile); | ||
img.exifdata = data || {}; | ||
img.iptcdata = iptcdata || {}; | ||
img.xmpdata = xmpdata || {}; | ||
if (EXIF.isXmpEnabled) { | ||
var xmpdata= findXMPinJPEG(binFile); | ||
img.xmpdata = xmpdata || {}; | ||
} | ||
if (callback) { | ||
@@ -892,2 +894,38 @@ callback.call(img); | ||
function xml2json(xml) { | ||
var json = {}; | ||
if (xml.nodeType == 1) { // element node | ||
if (xml.attributes.length > 0) { | ||
json['@attributes'] = {}; | ||
for (var j = 0; j < xml.attributes.length; j++) { | ||
var attribute = xml.attributes.item(j); | ||
json['@attributes'][attribute.nodeName] = attribute.nodeValue; | ||
} | ||
} | ||
} else if (xml.nodeType == 3) { // text node | ||
return xml.nodeValue; | ||
} | ||
// deal with children | ||
if (xml.hasChildNodes()) { | ||
for(var i = 0; i < xml.childNodes.length; i++) { | ||
var child = xml.childNodes.item(i); | ||
var nodeName = child.nodeName; | ||
if (json[nodeName] == null) { | ||
json[nodeName] = xml2json(child); | ||
} else { | ||
if (json[nodeName].push == null) { | ||
var old = json[nodeName]; | ||
json[nodeName] = []; | ||
json[nodeName].push(old); | ||
} | ||
json[nodeName].push(xml2json(child)); | ||
} | ||
} | ||
} | ||
return json; | ||
} | ||
function xml2Object(xml) { | ||
@@ -932,2 +970,10 @@ try { | ||
EXIF.enableXmp = function() { | ||
EXIF.isXmpEnabled = true; | ||
} | ||
EXIF.disableXmp = function() { | ||
EXIF.isXmpEnabled = false; | ||
} | ||
EXIF.getData = function(img, callback) { | ||
@@ -934,0 +980,0 @@ if (((self.Image && img instanceof self.Image) |
{ | ||
"name": "exif-js", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "JavaScript library for reading EXIF image metadata", | ||
@@ -5,0 +5,0 @@ "main": "exif.js", |
@@ -79,3 +79,3 @@ # Exif.js | ||
You can also get back a string with all the EXIF information in the image pretty printed by using `EXIF.pretty`. | ||
Check the included [example/index.html](/exif-js/exif-js/blob/master/example/index.html). | ||
Check the included [index.html](/exif-js/exif-js/blob/master/index.html). | ||
@@ -86,3 +86,4 @@ Please refer to the [source code](exif.js) for more advanced usages such as getting image data from a [File/Blob](https://developer.mozilla.org/en/docs/Web/API/Blob) object (`EXIF.readFromBinaryFile`). | ||
This is an [open source project](LICENSE.md). Please contribute by forking this repo and issueing a pull request. The project has had notable contributions already, like reading ITPC data. | ||
You can also contribute by [filing bugs or new features please issue](/exif-js/issues). | ||
Or improve the documentation. Please update this README when you do a pull request of proposed changes in base functionality. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1425478
15
970
88