adicu / adi-website

[DEPRECATED] The website for the Application Development Initiative, built on Eventum.
https://adicu.com
11 stars 15 forks source link

Deal with default profile pictures better. #204

Closed schlosser closed 9 years ago

schlosser commented 9 years ago

Our current approach (in app/models/User.py):

def get_profile_picture(self, size=50):
        """Returns the url to the profile picture for the user.

        TODO: This method needs major fixing.  What's going on with that URL?

        :param int size: The size of the image to pass, if the size can be
            changed.

        :returns: The URL of the image.
        :rtype: str
        """
        if self.image:
            return self.image.url()
        if not self.image_url:
            return ('https://lh6.googleusercontent.com/-K9HZ5Z5vOU8/'
                    'AAAAAAAAAAI/AAAAAAAAAAA/yRoMtBSXoxQ/s48-c/photo.jpg')
        if "googleusercontent.com" in self.image_url:
            return self.image_url + str(size)
        return self.image_url

Possible better approaches: