This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/app
David Taylor d0243f741e
UX: Use dominant color as image loading placeholder (#18248)
We previously had a system which would generate a 10x10px preview of images and add their URLs in a data-small-upload attribute. The client would then use that as the background-image of the `<img>` element. This works reasonably well on fast connections, but on slower connections it can take a few seconds for the placeholders to appear. The act of loading the placeholders can also break or delay the loading of the 'real' images.

This commit replaces the placeholder logic with a new approach. Instead of a 10x10px preview, we use imagemagick to calculate the average color of an image and store it in the database. The hex color value then added as a `data-dominant-color` attribute on the `<img>` element, and the client can use this as a `background-color` on the element while the real image is loading. That means no extra HTTP request is required, and so the placeholder color can appear instantly.

Dominant color will be calculated:
1. When a new upload is created
2. During a post rebake, if the dominant color is missing from an upload, it will be calculated and stored
3. Every 15 minutes, 25 old upload records are fetched and their dominant color calculated and stored. (part of the existing PeriodicalUpdates job)

Existing posts will continue to use the old 10x10px placeholder system until they are next rebaked
2022-09-20 10:28:17 +01:00
..
adapters FIX: Avoid duplicate topic-list requests (#18073) 2022-08-24 11:54:01 +01:00
components FIX: header offset position was not correct in some cases (#18155) 2022-09-19 14:56:34 +02:00
controllers DEV: update yes/no confirmation dialogs (#18181) 2022-09-14 11:06:56 -04:00
helpers FEATURE: show status in search results when mentioning user in composers (#17811) 2022-08-10 19:49:26 +04:00
initializers FIX: Overriding text with admin_js.* keys didn't work (#18281) 2022-09-20 10:47:57 +10:00
lib UX: Use dominant color as image loading placeholder (#18248) 2022-09-20 10:28:17 +01:00
mixins DEV: Use .ember-application instead of #main 2022-08-23 09:24:00 +08:00
models DEV: Refactor composer and logout dialogs (#18156) 2022-09-13 12:30:52 -04:00
modifiers DEV: Install ember-modifier and @ember/render-modifiers (#17595) 2022-07-21 18:12:29 +01:00
pre-initializers DEV: Log theme error names and messages (#18260) 2022-09-15 14:14:52 +02:00
raw-views DEV: Use method definition syntax consistently (#14915) 2021-11-13 14:01:55 +01:00
routes FIX: Ensure discovery-categories always clears PreloadStore (#18157) 2022-09-01 16:11:13 +01:00
services DEV: Minor code cleanup (#18225) 2022-09-12 14:05:21 +02:00
styles DEV: Migrate to Ember CLI (#11932) 2021-02-03 14:22:20 -05:00
templates DEV: Remove redundant args for user-main-nav plugin outlet (#18284) 2022-09-20 17:12:15 +08:00
widgets Revert "UX: Retry "left-align title with content for sidebar (#18202)" (#18242)" (#18278) 2022-09-19 11:05:41 -04:00
app.js DEV: Modernize Ember Resolver (#17353) 2022-07-06 14:20:00 +01:00
index.html DEV: Preload CSS in the <head> (#17322) 2022-07-05 00:23:09 +08:00
mapping-router.js DEV: Improve and document __container__ workaround in tests (#15498) 2022-01-10 10:34:08 +00:00