浏览代码

Merge pull request #12192 from Ithanil/avatar_compression

feat: adjust jpeg compression quality to 0.15 for avatar uploads
Timothy Jaeryang Baek 4 月之前
父节点
当前提交
9c00f3caf3
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/lib/components/chat/Settings/Account.svelte

+ 2 - 1
src/lib/components/chat/Settings/Account.svelte

@@ -132,7 +132,8 @@
 						ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight);
 
 						// Get the base64 representation of the compressed image
-						const compressedSrc = canvas.toDataURL('image/jpeg');
+						const jpegQuality = 0.15;
+						const compressedSrc = canvas.toDataURL('image/jpeg', jpegQuality);
 
 						// Display the compressed image
 						profileImageUrl = compressedSrc;