From 3222106c5fcf6fc56317ef079ce03c6b837d1d6d Mon Sep 17 00:00:00 2001 From: Chris Keathley Date: Fri, 23 Oct 2015 16:56:40 -0400 Subject: [PATCH 1/9] add var in for loop If exif-js is required as a module then it throws an `Uncaught ReferenceError: n is not defined`. Added the proper scoping with var in order to solve this. --- exif.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exif.js b/exif.js index 296a338..1506ebb 100644 --- a/exif.js +++ b/exif.js @@ -642,7 +642,7 @@ function getStringFromDB(buffer, start, length) { var outstr = ""; - for (n = start; n < start+length; n++) { + for (var n = start; n < start+length; n++) { outstr += String.fromCharCode(buffer.getUint8(n)); } return outstr; From 1b5b30fa0dd2b1e0c274789eefcb5329fd41bea8 Mon Sep 17 00:00:00 2001 From: Bart van der Wal Date: Sun, 10 Sep 2017 22:54:00 +0200 Subject: [PATCH 2/9] Oops forgot bower and README for 2.3 release of issue #114 fixed. --- README.md | 3 +++ bower.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a4f751..d334de7 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ Note there are also alternate tags, such the `EXIF.TiffTags`. See the source cod You can also get back a string with all the EXIF information in the image pretty printed by using `EXIF.pretty`. Check the included [index.html](/exif-js/exif-js/blob/master/index.html). +**XMP** +Since issue #53 was merged also extracting of XMP data is supported. To not slow down this is optional, and you need to call `EXIF.enableXmp();` before using `..getDatat()`. + 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`). ## Contributions diff --git a/bower.json b/bower.json index 9d8533b..0838f80 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "exif-js", - "version": "2.2.2", + "version": "2.3.0", "homepage": "https://github.com/exif-js/exif-js", "authors": [ "Jacob Seidelin" From cacb4d828197476f279df197468116f865a1ff1c Mon Sep 17 00:00:00 2001 From: Patrick Metcalfe Date: Thu, 18 Jan 2018 14:29:30 -0800 Subject: [PATCH 3/9] Fix input type when it's a file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d334de7..acc4307 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The package adds a global `EXIF` variable (or AMD or CommonJS equivalent). Start with calling the `EXIF.getData` function. You pass it an image as a parameter: - either an image from a `` -- OR a user selected image in a `` element on your page. +- OR a user selected image in a `` element on your page. As a second parameter you specify a callback function. In the callback function you should use `this` to access the image with the aforementioned metadata you can then use as you want. That image now has an extra `exifdata` property which is a Javascript object with the EXIF metadata. You can access it's properties to get data like the *image caption*, the *date a photo was taken* or it's *orientation*. From ca30d3a8035811848f72975e06ea9066ed1bc3be Mon Sep 17 00:00:00 2001 From: Hirokazu Yokoyama Date: Tue, 6 Feb 2018 21:19:09 +0900 Subject: [PATCH 4/9] insert types option --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ee4cf2f..8da629d 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.3.0", "description": "JavaScript library for reading EXIF image metadata", "main": "exif.js", + "types": "exif.d.ts", "directories": { "example": "example" }, From dfd5c4e2c4dc7a37ceef01b44fd5f29141a496eb Mon Sep 17 00:00:00 2001 From: Boris K Date: Fri, 5 Oct 2018 23:22:45 +0200 Subject: [PATCH 5/9] Add CDN URL in README (#173) --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index acc4307..2c777a3 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,15 @@ Or [Bower](http://bower.io/): Then add a `script` tag in your an HTML in the [best position](http://stackoverflow.com/questions/436411/where-is-the-best-place-to-put-script-tags-in-html-markup) referencing your local file. - +```html + +``` -**Note**: This repo has no `.min.js`. Do your own [minification](https://en.wikipedia.org/wiki/Minification_(programming)) if you want that. +You can also use a minified version hosted on jsDelivr -If you prefer another package manager you will probably manage :D. Or you can clone this GIT repository or download it's ZIP file and extract `exif.js` to your project. +```html + +``` ## Usage The package adds a global `EXIF` variable (or AMD or CommonJS equivalent). @@ -67,7 +71,7 @@ function getExif() { **HTML**: ```html -
Make and model: 
+
Make and model: 



From 6b71144a088fea3bd36fdb44fc2bc4a74d2c0202 Mon Sep 17 00:00:00 2001
From: weepy 
Date: Wed, 7 Nov 2018 12:11:59 +0000
Subject: [PATCH 6/9] missing var (#64)


From bbae15d4f41e29c794d962957005f04837b19655 Mon Sep 17 00:00:00 2001
From: FreiDemokrat 
Date: Wed, 7 Nov 2018 13:37:37 +0100
Subject: [PATCH 7/9] Update exif.js (#170)

Add SVG support
---
 exif.js | 49 ++++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/exif.js b/exif.js
index 1984373..3a91e59 100644
--- a/exif.js
+++ b/exif.js
@@ -1,6 +1,6 @@
 (function() {
 
-    var debug = false;
+    var debug= false;
 
     var root = this;
 
@@ -14,9 +14,9 @@
         if (typeof module !== 'undefined' && module.exports) {
             exports = module.exports = EXIF;
         }
-        exports.EXIF = EXIF;
+        exports.EXIF= EXIF;
     } else {
-        root.EXIF = EXIF;
+        root.EXIF= EXIF;
     }
 
     var ExifTags = EXIF.Tags = {
@@ -365,30 +365,34 @@
         http.send();
     }
 
-    function getImageData(img, callback) {
-        function handleBinaryFile(binFile) {
-            var data = findEXIFinJPEG(binFile);
-            img.exifdata = data || {};
-            var iptcdata = findIPTCinJPEG(binFile);
-            img.iptcdata = iptcdata || {};
+        EXIF.handleBinaryFile= handleBinaryFile= function(img, binFile) { console.log(arguments);
+            var data= findEXIFinJPEG(binFile);
+            img.exifdata= data || {};
+            var iptcdata= findIPTCinJPEG(binFile);
+            img.iptcdata= iptcdata || {};
             if (EXIF.isXmpEnabled) {
                var xmpdata= findXMPinJPEG(binFile);
-               img.xmpdata = xmpdata || {};               
+               img.xmpdata= xmpdata || {};               
             }
-            if (callback) {
-                callback.call(img);
+            if(callback){
+               if(typeof callback == "function") callback.call(img);
             }
         }
 
+    EXIF.getImageData= getImageData =function (img, callback) {
+
+        //EXIF.handleBinaryFile= handleBinaryFile; //Moded
+        if(img.getAttributeNS('http://www.w3.org/1999/xlink', 'href')) img.src= img.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
+
         if (img.src) {
             if (/^data\:/i.test(img.src)) { // Data URI
-                var arrayBuffer = base64ToArrayBuffer(img.src);
-                handleBinaryFile(arrayBuffer);
+                var arrayBuffer= base64ToArrayBuffer(img.src);
+                handleBinaryFile(img, arrayBuffer);
 
             } else if (/^blob\:/i.test(img.src)) { // Object URL
-                var fileReader = new FileReader();
-                fileReader.onload = function(e) {
-                    handleBinaryFile(e.target.result);
+                var fileReader= new FileReader();
+                fileReader.onload= function(e) {
+                    handleBinaryFile(img, e.target.result);
                 };
                 objectURLToBlob(img.src, function (blob) {
                     fileReader.readAsArrayBuffer(blob);
@@ -397,7 +401,7 @@
                 var http = new XMLHttpRequest();
                 http.onload = function() {
                     if (this.status == 200 || this.status === 0) {
-                        handleBinaryFile(http.response);
+                        handleBinaryFile(img, http.response);
                     } else {
                         throw "Could not load image";
                     }
@@ -407,18 +411,18 @@
                 http.responseType = "arraybuffer";
                 http.send(null);
             }
-        } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {
+        }else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {
             var fileReader = new FileReader();
             fileReader.onload = function(e) {
                 if (debug) console.log("Got file of length " + e.target.result.byteLength);
-                handleBinaryFile(e.target.result);
+                handleBinaryFile(img, e.target.result);
             };
 
             fileReader.readAsArrayBuffer(img);
         }
     }
 
-    function findEXIFinJPEG(file) {
+    EXIF.findEXIFinJPEG= findEXIFinJPEG= function(file) {
         var dataView = new DataView(file);
 
         if (debug) console.log("Got file of length " + file.byteLength);
@@ -437,7 +441,7 @@
                 return false; // not a valid marker, something is wrong
             }
 
-            marker = dataView.getUint8(offset + 1);
+            marker= dataView.getUint8(offset + 1);
             if (debug) console.log(marker);
 
             // we could implement handling for other markers here,
@@ -1056,4 +1060,3 @@
         });
     }
 }.call(this));
-

From 53b0c7c1951a23d255e37ed0a883462218a71b6f Mon Sep 17 00:00:00 2001
From: Bart van der Wal 
Date: Wed, 7 Nov 2018 17:59:40 +0100
Subject: [PATCH 8/9] Revert "Update exif.js (#170)" (#177)

This reverts commit bbae15d4f41e29c794d962957005f04837b19655.
---
 exif.js | 49 +++++++++++++++++++++++--------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/exif.js b/exif.js
index 3a91e59..1984373 100644
--- a/exif.js
+++ b/exif.js
@@ -1,6 +1,6 @@
 (function() {
 
-    var debug= false;
+    var debug = false;
 
     var root = this;
 
@@ -14,9 +14,9 @@
         if (typeof module !== 'undefined' && module.exports) {
             exports = module.exports = EXIF;
         }
-        exports.EXIF= EXIF;
+        exports.EXIF = EXIF;
     } else {
-        root.EXIF= EXIF;
+        root.EXIF = EXIF;
     }
 
     var ExifTags = EXIF.Tags = {
@@ -365,34 +365,30 @@
         http.send();
     }
 
-        EXIF.handleBinaryFile= handleBinaryFile= function(img, binFile) { console.log(arguments);
-            var data= findEXIFinJPEG(binFile);
-            img.exifdata= data || {};
-            var iptcdata= findIPTCinJPEG(binFile);
-            img.iptcdata= iptcdata || {};
+    function getImageData(img, callback) {
+        function handleBinaryFile(binFile) {
+            var data = findEXIFinJPEG(binFile);
+            img.exifdata = data || {};
+            var iptcdata = findIPTCinJPEG(binFile);
+            img.iptcdata = iptcdata || {};
             if (EXIF.isXmpEnabled) {
                var xmpdata= findXMPinJPEG(binFile);
-               img.xmpdata= xmpdata || {};               
+               img.xmpdata = xmpdata || {};               
             }
-            if(callback){
-               if(typeof callback == "function") callback.call(img);
+            if (callback) {
+                callback.call(img);
             }
         }
 
-    EXIF.getImageData= getImageData =function (img, callback) {
-
-        //EXIF.handleBinaryFile= handleBinaryFile; //Moded
-        if(img.getAttributeNS('http://www.w3.org/1999/xlink', 'href')) img.src= img.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
-
         if (img.src) {
             if (/^data\:/i.test(img.src)) { // Data URI
-                var arrayBuffer= base64ToArrayBuffer(img.src);
-                handleBinaryFile(img, arrayBuffer);
+                var arrayBuffer = base64ToArrayBuffer(img.src);
+                handleBinaryFile(arrayBuffer);
 
             } else if (/^blob\:/i.test(img.src)) { // Object URL
-                var fileReader= new FileReader();
-                fileReader.onload= function(e) {
-                    handleBinaryFile(img, e.target.result);
+                var fileReader = new FileReader();
+                fileReader.onload = function(e) {
+                    handleBinaryFile(e.target.result);
                 };
                 objectURLToBlob(img.src, function (blob) {
                     fileReader.readAsArrayBuffer(blob);
@@ -401,7 +397,7 @@
                 var http = new XMLHttpRequest();
                 http.onload = function() {
                     if (this.status == 200 || this.status === 0) {
-                        handleBinaryFile(img, http.response);
+                        handleBinaryFile(http.response);
                     } else {
                         throw "Could not load image";
                     }
@@ -411,18 +407,18 @@
                 http.responseType = "arraybuffer";
                 http.send(null);
             }
-        }else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {
+        } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {
             var fileReader = new FileReader();
             fileReader.onload = function(e) {
                 if (debug) console.log("Got file of length " + e.target.result.byteLength);
-                handleBinaryFile(img, e.target.result);
+                handleBinaryFile(e.target.result);
             };
 
             fileReader.readAsArrayBuffer(img);
         }
     }
 
-    EXIF.findEXIFinJPEG= findEXIFinJPEG= function(file) {
+    function findEXIFinJPEG(file) {
         var dataView = new DataView(file);
 
         if (debug) console.log("Got file of length " + file.byteLength);
@@ -441,7 +437,7 @@
                 return false; // not a valid marker, something is wrong
             }
 
-            marker= dataView.getUint8(offset + 1);
+            marker = dataView.getUint8(offset + 1);
             if (debug) console.log(marker);
 
             // we could implement handling for other markers here,
@@ -1060,3 +1056,4 @@
         });
     }
 }.call(this));
+

From 51a8f7d2f3aa71cb03463c84088067c9a4ebe8cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20F=C3=B6rster?= 
Date: Tue, 16 Apr 2024 14:43:11 +0200
Subject: [PATCH 9/9] another typo fix on readme (#272)

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 2c777a3..a81220e 100644
--- a/README.md
+++ b/README.md
@@ -83,7 +83,7 @@ You can also get back a string with all the EXIF information in the image pretty
 Check the included [index.html](/exif-js/exif-js/blob/master/index.html).
 
 **XMP**
-Since issue #53 was merged also extracting of XMP data is supported. To not slow down this is optional, and you need to call `EXIF.enableXmp();` before using `..getDatat()`.
+Since issue #53 was merged also extracting of XMP data is supported. To not slow down this is optional, and you need to call `EXIF.enableXmp();` before using `EXIF.getData()`.
 
 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`).