adding support for out of band avatars

This commit is contained in:
or-else
2021-05-10 11:38:53 -07:00
parent 02e1a28e89
commit 74d5473a8b
16 changed files with 115 additions and 78 deletions
+9 -4
View File
@@ -6,10 +6,15 @@ import { bytesToHumanSize } from './strformat.js'
export const SUPPORTED_IMAGE_FORMATS = ['image/jpeg', 'image/gif', 'image/png', 'image/svg', 'image/svg+xml'];
export const MIME_EXTENSIONS = ['jpg', 'gif', 'png', 'svg', 'svg'];
// Make a data URL from public.photo
export function makeImageUrl(photo) {
return (photo && photo.type && photo.data) ?
'data:image/' + photo.type + ';base64,' + photo.data : null;
// Make a data: URL from public.photo
export function makeImageDataUrl(photo) {
if (photo) {
if (photo.data && photo.type) {
return 'data:image/' + photo.type + ';base64,' + photo.data;
}
return photo.ref;
}
return null;
}
// Calculate linear dimensions for scaling image down to fit under a certain size.