Nodebb: RFC: uploading user profile backgrounds / avatars

Created on 4 Jun 2016  路  3Comments  路  Source: NodeBB/NodeBB

On our forum, we have the uploads folder served by nginx with very aggressive caching under the assumption that uploaded files don't get changed. For most uploads, this is true, but for avatars and profile backgrounds, the new one replaces the old one at the same address. This means:

  • Users have to hard-refresh the page to see a new profile background or avatar
  • Avatars (the most common type of image on any given page) cause an extra HTTP request per user if they aren't cached aggressively
  • Commentary about avatars or profile backgrounds loses meaning when the avatar or profile background changes

Instead, I recommend:

  • When an avatar or profile background is uploaded, give it a unique address just like any other upload.
  • Do not delete the old avatar or profile background from the filesystem.
enhancement

Most helpful comment

Unless the avatars are multi-MB images (shame shame shame!) I would think having versioned avatars wouldn't be a bad thing, since most users wouldn't do it (defeating the space argument), and those that do would enjoy the benefits of updated images, satisfying everyone concerned I would think.

All 3 comments

If the files are never deleted, wouldn't you run into storage issues? Images are not deleted if you use an upload plugin like imgur.

Suppose the argument here is that storage is cheap?

Unless the avatars are multi-MB images (shame shame shame!) I would think having versioned avatars wouldn't be a bad thing, since most users wouldn't do it (defeating the space argument), and those that do would enjoy the benefits of updated images, satisfying everyone concerned I would think.

Was this page helpful?
0 / 5 - 0 ratings