Skip to content

Instantly share code, notes, and snippets.

@dileephell
Last active December 14, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dileephell/5064310 to your computer and use it in GitHub Desktop.
Save dileephell/5064310 to your computer and use it in GitHub Desktop.
var ExifImage = require('exif').ExifImage;
var easyimg= require('easyimage');
var path = require('path');
var uuid=require('node-uuid');
var tmp_path = req.files.uploadimgs.path,uuid;
console.log(uuid);
fs.exists('/upload/work',function(exists){
fs.mkdir('./upload/work',function() {
var target_path = './upload/work/'+uuid() +'.png';
fs.rename(tmp_path, target_path, function(err) {
if (err) throw err;
console.log('cfgh');
// delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files
fs.unlink(tmp_path, function() {
if (err) throw err;
console.log('fdsggghggff');
res.send('File uploaded to: ' + target_path + ' - ' + req.files.uploadimgs.size + ' bytes');
try {
new ExifImage({ image : './home/dileep/Pictures/myimage.jpg'}, function (error, image) {
if (error)
console.log('Error: '+error.message);
else
console.log(image); // Do something with your data!
});
} catch (error) {
console.log('Error: ' + error);
}
});
});
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment