diff --git a/utility/exif/94-exif.html b/utility/exif/94-exif.html index 47c79101..3f7d99ac 100644 --- a/utility/exif/94-exif.html +++ b/utility/exif/94-exif.html @@ -1,6 +1,13 @@ diff --git a/utility/exif/94-exif.js b/utility/exif/94-exif.js index dbddba9f..0b1da20f 100644 --- a/utility/exif/94-exif.js +++ b/utility/exif/94-exif.js @@ -11,7 +11,9 @@ module.exports = function(RED) { function ExifNode(n) { RED.nodes.createNode(this,n); - this.property = n.property || "payload"; + this.mode = n.mode || "normal"; + if (this.mode === "worldmap") { this.property = "payload.content"; } + else { this.property = n.property || "payload"; } var node = this; /*** @@ -72,10 +74,12 @@ module.exports = function(RED) { else if (msg.hasOwnProperty("filename")) { na = msg.filename.split('/').pop(); } else { na = msg.exif.image.Make+"_"+msg.exif.image.ModifyDate; } msg.location.name = na; + msg.location.layer = "Images"; msg.location.popup = '' } this.on("input", function(msg) { + if (node.mode === "worldmap" && (msg.payload.action !== "file" || msg.payload.type.indexOf("image") === -1)) { return; } // in case worldmap-in not filtered. try { var value = RED.util.getMessageProperty(msg,node.property); if (value !== undefined) { @@ -87,7 +91,13 @@ module.exports = function(RED) { if (Buffer.isBuffer(value)) { // or a proper jpg buffer new ExifImage({ image:value }, function (error, exifData) { if (error) { - node.log(error.toString()); + if (node.mode !== "worldmap") { + node.log(error.toString()); + } + else { + msg.location = {name:msg.payload.name, lat:msg.payload.lat, lon:msg.payload.lon, layer:"Images", icon:"fa-camera", draggable:true}; + msg.location.popup = '
'; + } } else { if (exifData) { @@ -101,6 +111,10 @@ module.exports = function(RED) { node.warn("The incoming image did not contain any Exif data, nothing to do."); } } + if (node.mode === "worldmap") { + msg.payload = msg.location; + delete msg.location; + } node.send(msg); }); } diff --git a/utility/exif/package.json b/utility/exif/package.json index 5eb5e30b..639bbcef 100644 --- a/utility/exif/package.json +++ b/utility/exif/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-exif", - "version": "0.1.0", + "version": "0.2.0", "description": "A Node-RED node that extracts Exif information from JPEG image buffers.", "dependencies": { "exif": "^0.6.0"