Skip to content

Commit

Permalink
Merge branch 'develop' into the-empty-string-conundrum
Browse files Browse the repository at this point in the history
  • Loading branch information
vynmera authored Jun 5, 2018
2 parents d81bcb6 + 5565503 commit dceaa6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/rocketchat-file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ Object.assign(FileUpload, {
s.rotate();
// Get metadata to resize the image the first time to keep "inside" the dimensions
// then resize again to create the canvas around

s.metadata(Meteor.bindEnvironment((err, metadata) => {
if (!metadata) {
metadata = {};
}

s.toFormat(sharp.format.jpeg)
.resize(Math.min(height, metadata.width), Math.min(height, metadata.height))
.resize(Math.min(height || 0, metadata.width || Infinity), Math.min(height || 0, metadata.height || Infinity))
.pipe(sharp()
.resize(height, height)
.background('#FFFFFF')
Expand Down

0 comments on commit dceaa6c

Please sign in to comment.