Assuming most users won’t set up their avatars is it better to store a value like default.jpg in user’s table avatar column while creating new user or to check for existence of value in controller/view and if it’s null display the default one?
Share
I would leave it empty, and perform the check via code.
It leaves me the option of changing from, say
default.jpgtodefault.pngat a later date without having to touch the database. Or doing other fun stuff, like how SO generates ‘default’ avatars.It feels cleaner to me (The user didn’t choose an avatar. Therefore, empty field. If the user didn’t enter her age, would you make one up? No.)
By the way, you really should check out gravatar.com before implementing yet another avatar. I love it that I need to upload my avatar just once to one website and all other sites (like SO) automatically use it.