Created
March 1, 2013 11:36
-
-
Save dileephell/5064109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
easyimg.resize({src:'./upload/work/abcd.png', dst:'./upload/work/abcd_small.png', width:50, height:50}, function(err, stdout, stderr) { | |
if (err) throw err; | |
console.log('Resized to 50x50'); | |
}); | |
try { | |
new ExifImage({ image : 'abcd.png' }, 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); | |
} | |
}); | |
}); | |
}); | |
}); | |
}; | |
1 Mar 17:03:53 - [nodemon] starting `node test.js` | |
{ [Function: v4] | |
v1: [Function: v1], | |
v4: [Circular], | |
parse: [Function: parse], | |
unparse: [Function: unparse], | |
BufferClass: | |
{ [Function: Buffer] | |
poolSize: 8192, | |
isBuffer: [Function: isBuffer], | |
byteLength: [Function], | |
concat: [Function], | |
_charsWritten: 20 } } | |
cfgh | |
fdsggghggff | |
/home/dileep/Downloads/kak/routes/imageupload.js:151 | |
if (err) throw err; | |
^ | |
Error: Command failed: convert: unable to open image `./upload/work/abcd.png': @ error/blob.c/OpenBlob/2587. | |
convert: unable to open file `./upload/work/abcd.png' @ error/png.c/ReadPNGImage/3238. | |
convert: missing an image filename `./upload/work/abcd_small.png' @ error/convert.c/ConvertImageCommand/3011. | |
at ChildProcess.exithandler (child_process.js:540:15) | |
at ChildProcess.EventEmitter.emit (events.js:99:17) | |
at maybeClose (child_process.js:638:16) | |
at Process._handle.onexit (child_process.js:680:5) | |
1 Mar 17:04:14 - [nodemon] app crashed - waiting for file changes before starting... | |
above my code is and the following error comes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment