feat: Add a placeholder for image attachments in conversations view (#8969)

We analyze an image to get it's height and width. On the frontend, we would show a placeholder with the corresponding width and height until the images are loaded properly.

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
Nithin David Thomas
2024-02-27 14:46:16 -08:00
committed by GitHub
parent fd993feece
commit b7a83dcbcd
4 changed files with 22 additions and 6 deletions

View File

@@ -76,7 +76,9 @@ class Attachment < ApplicationRecord
extension: extension,
data_url: file_url,
thumb_url: thumb_url,
file_size: file.byte_size
file_size: file.byte_size,
width: file.metadata[:width],
height: file.metadata[:height]
}
metadata[:data_url] = metadata[:thumb_url] = external_url if message.instagram_story_mention?