node.js - NodeJS: Rotating JPEG with GM not working -
i'm writing api endpoint accept images , send them s3 server. before that, however, has orient images correctly not display wrong when in image tags. since jpegs use exif data determine image rotation , img tag not refer exif data orientation information, images appear sideways on website, right side on other platforms. here code rotating image:
if (file.mimetype == 'image/jpeg'){ var exifdata = parser.create(uploadedfile).parse(); if (exifdata.tags.orientation == 6 || exifdata.tags.orientation == 8){ var degrees = exifdata.tags.orientation == 6 ? 90 : 270; gm(file.path).rotate('black', degrees).write(file.path, function(err){ if (err) return cb1(err); finish(); }); }else finish(); }else finish();
finish()
function sends file off s3. why image not rotating? have set overwrite existing file on rotate. there no errors being returned, entire call fail.
Comments
Post a Comment