Skip to content
Snippets Groups Projects
Commit 6f057e7b authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Improve avatar resize function to use GM detection and allow change setting on runtime

parent 2a8bac74
No related branches found
No related tags found
No related merge requests found
......@@ -11,12 +11,14 @@ Meteor.startup ->
console.log "Using #{storeType} for Avatar storage".green
transformWrite = undefined
if RocketChat.settings.get('Accounts_AvatarResize') is true
transformWrite = (file, readStream, writeStream) ->
if RocketChatFile.enabled is false or RocketChat.settings.get('Accounts_AvatarResize') isnt true
return readStream.pipe writeStream
height = RocketChat.settings.get 'Accounts_AvatarSize'
width = height
transformWrite = (file, readStream, writeStream) ->
RocketChatFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream)
RocketChatFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream)
path = "~/uploads"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment