Sunday, 19 March 2017

retrieve image location stored in mongodb and displaying image stored in local fs using node.js

I have an app where I am storing file on my local fs and metadata for the image in mongodb using Node.js. Now I am creating a get request to display the images. I am looking to check the image location in mongodb (if it exists or not) and if yes then retrieve the image from that path from my local system using node.js My Mongodb collection looks like this. so based on alertid requested i want to check the filepath (stored in media) and retrieve the images associated with the alert from my system locally. I am able to fetch images directly but not able to link mongodb for path verification

deviceID: '2',

location: { lat: '37.338208', long: '-1356363553' }, deviceType: 'mobileStation', sourceID: '435667', destID: '09876543', alertType: 'BEDDDD', dataType: 'image', media: [ { fieldname: 'media', originalname: 'Screenshot 2015-09-07 15.17.31.png', encoding: '7bit', mimetype: 'image/png', destination: './views/up', filename: '850a447a286ef9feaa7f26ef752ffd73', path: 'views\up\850a447a286ef9feaa7f26ef752ffd73', size: 165461 } ] }



via Navit Gaur

No comments:

Post a Comment