Small code style fixes
Add function to generate gravatar URLs

This function can be used in controllers and in templates. It wraps all
necessary image URL creation, including checking whether or not the
current request is HTTPS and picking the appropriate domain.