parse-image
parse-image copied to clipboard
In high res images, the height and width are fetched in reverse
I'm using this module just for fetching the width and height of stored images in my parse server. I've noticed there are times that the width and height are fetched in reverse, meaning the width is the actual height and the height is the actual width!
Here's the function I'm calling inside an afterSave
trigger:
var storeImageDimensions = function(postObject) {
var imageFile = postObject.get("imageLowQuality");
Parse.Cloud.httpRequest({
url: imageFile.url(),
success: function(response) {
// The file contents are in response.buffer.
var Image = require("parse-image");
var image = new Image();
// ----------------------------------
image.setData(response.buffer, {
success: function() {
var imageDimensions = {};
imageDimensions.width = image.width();
imageDimensions.height = image.height();
// ----------------------------------
postObject.set("imageDimensions", imageDimensions);
postObject.save(null, {useMasterKey: true});
},
error: function(error) {
// The image data was invalid.
}
})
},
error: function(error) {
// The networking request failed.
}
});
}
Any idea why's that happening?