 		transformWrite: transformWrite
 
 	WebApp.connectHandlers.use '/avatar/', (req, res, next) ->
-		console.log 'avatar called!'
 		this.params =
 			username: req.url.replace(/^\//, '').replace(/\?.*$/, '')
 

Meteor.startup ->
	storeType = 'FileSystem'


	# Sandstorm must store avatar in mongo
	#if RocketChat.settings.get 'avatarStore_type'
	#	storeType = RocketChat.settings.get 'avatarStore_type'


	RocketChatStore = RocketChatFile[storeType]


		transformWrite = (file, readStream, writeStream) ->
			RocketChatFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream)

	path = "~/uploads"

	if RocketChat.settings.get('Accounts_AvatarStorePath')?.trim() isnt ''
		path = RocketChat.settings.get 'Accounts_AvatarStorePath'
