discourse/spec/requests/api/schemas/json
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
..
admin_user_list_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
admin_user_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
backups_create_request.json
backups_list_response.json
badge_create_request.json
badge_create_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
badge_list_response.json DEV: Fix flaky admin badges.json api docs spec (#17210) 2022-06-23 14:32:17 -06:00
badge_update_request.json
badge_update_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
category_create_request.json
category_create_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
category_list_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
category_topics_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
category_update_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
group_add_members_request.json
group_add_members_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
group_create_request.json DEV: Tidy up create group api endpoint docs (#17586) 2022-07-20 19:18:48 -06:00
group_create_response.json DEV: Tidy up create group api endpoint docs (#17586) 2022-07-20 19:18:48 -06:00
group_members_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
group_remove_members_request.json
group_remove_members_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
group_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
groups_list_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
post_delete_request.json DEV: Document delete post API endpoint (#15495) 2022-01-07 16:09:32 -07:00
post_replies_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
search_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
site_response.json FEATURE: add welcome topic cta banner (#17821) 2022-08-09 21:52:39 +05:30
success_ok_response.json
tag_group_create_request.json
tag_group_create_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
topic_create_request.json DEV: Document external topic id endpoints (#15897) 2022-02-10 19:01:19 -07:00
topic_create_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
topic_show_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
upload_abort_multipart_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_batch_presign_multipart_parts_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_batch_presign_multipart_parts_response.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_complete_external_upload_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_complete_multipart_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_create_multipart_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_create_multipart_response.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_create_request.json
upload_create_response.json UX: Use dominant color as image loading placeholder (#18248) 2022-09-20 10:28:17 +01:00
upload_generate_presigned_put_request.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
upload_generate_presigned_put_response.json DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
user_actions_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
user_anonymize_response.json
user_badges_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
user_create_request.json FEATURE: API to create user's associated account (#15737) 2022-03-03 18:17:02 +02:00
user_create_response.json
user_delete_request.json
user_delete_response.json
user_emails_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
user_get_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00
user_password_change_request.json
user_password_reset_request.json
user_password_reset_response.json
user_refresh_gravatar_response.json
user_silence_request.json FIX: Show suspended by user (#16927) 2022-06-01 14:54:23 +02:00
user_silence_response.json FIX: Show suspended by user (#16927) 2022-06-01 14:54:23 +02:00
user_suspend_request.json
user_suspend_response.json FIX: Show suspended by user (#16927) 2022-06-01 14:54:23 +02:00
user_update_avatar_request.json
user_update_email_request.json
user_update_request.json FEATURE: API to create user's associated account (#15737) 2022-03-03 18:17:02 +02:00
user_update_response.json FEATURE: API to create user's associated account (#15737) 2022-03-03 18:17:02 +02:00
user_update_username_request.json DEV: Update api docs to update username and to get post replies (#15881) 2022-02-09 15:04:36 -07:00
users_public_list_response.json repair structural problems with the openapi spec (#16710) 2022-06-20 10:56:56 -06:00