You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fsTTL30s: !isEmpty(process.env.FILE_SERVER_TTL_30S),// Note: some stuff are init when the app start, so this flag should only be set from the env itself.
70
+
// Note: some stuff are init when the app starts, so fsTTL30s should only be set from the env itself (before app starts)
// NOTE Put new feature flags in here during development so they are not available in production environments. Remove from here when they are ready for QA and production
@@ -33,43 +30,13 @@ import type { ProcessedLinkPreviewThumbnailType } from '../../webworker/workers/
33
30
* 10. We use the grabbed data for upload of the attachments, get an url for each of them and send the url with the attachments details to the user/opengroup/closed group
34
31
*/
35
32
36
-
exporttypeBetterBlob=Blob&{
37
-
__brand: 'BetterBlob';
38
-
/** @deprecated -- `type` should not be used, it can be tampered with, use @see {@link contentType} */
Copy file name to clipboardExpand all lines: ts/webworker/workers/node/image_processor/image_processor.d.ts
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ export type ImageProcessorWorkerActions = {
60
60
61
61
/**
62
62
* Process an image to get a thumbnail matching our required details for link previews
63
-
* A link preview thumbnail is always a png, and resized to "contain" the image.
63
+
* A link preview thumbnail is always a png, and resized to "cover".
64
64
*/
65
65
processForLinkPreviewThumbnail: (
66
66
input: ArrayBufferLike,
@@ -71,10 +71,10 @@ export type ImageProcessorWorkerActions = {
71
71
* Process an image to get a thumbnail matching our required details for in conversation thumbnails
72
72
* This is about the thumbnail in the conversation list (for attachments in messages). We generate a preview to avoid loading huge files until we show them in fullscreen.
73
73
*
74
-
* Note: an animated image or not animated will always be returned as a png.
74
+
* Note: animated or not, an image will always be returned as a png.
75
75
* Note: eventually we want to support animated images as previews too. When we do, we will need to
76
76
* convert them to webp and resize their preview heavily for performance reasons.
77
-
* A 'in conversation thumbnail' is always resized to "fill" the image.
77
+
* A 'in conversation thumbnail' is always resized to "cover".
78
78
*/
79
79
processForInConversationThumbnail: (
80
80
input: ArrayBufferLike,
@@ -89,13 +89,22 @@ export type ImageProcessorWorkerActions = {
89
89
* - not an image, or
90
90
* - not one we can process (i.e enforced lossless),
91
91
* - or we cannot get an image small enough after dropping the quality
92
-
* null will be returned. The caller should check if the requirements are met before trying to upload.
93
-
*
94
-
* The caller should check that the requirements have been met before trying to upload.
92
+
* null will be returned.
93
+
* The caller should always check if the requirements are met before trying to upload.
95
94
*
96
95
* Note: the lossy formats are jpeg, webp and avif.
97
96
* Anything else that is an image supported by sharp will only be scaled down to maxSidePx.
98
-
* Anything else not an image supported by sharp will return null
97
+
* Anything else not an image supported by sharp will return null.
98
+
*
99
+
* To make it clear,
100
+
* - if the image is **lossy** and already fits the requirements, we return it as is.
101
+
* - if the image is **lossless**:
102
+
* - if it fits the requirements, we return it as is (not even scaled down, as we'd need a loader in the staged attachments list to display the loading state)
103
+
* - if it does not fit the requirements, we return null
104
+
* - if the image is **lossy** and doesn't fit:
105
+
* - we first scale it down the maxSize, and then iterate over the quality to get something that fits the maxSizeBytes.
106
+
* - if we cannot get a file under maxSizeBytes, we return null
107
+
*
99
108
*
100
109
* @param input: the image data to process
101
110
* @param maxSidePx: we cap an image to this size. If the image is larger, it will be scaled down to this before we start dropping the quality.
0 commit comments