mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(web): avoid transparent pixels from rounded-full during profile picture capture (#25950)
The cropContainer has rounded-full class which creates transparent corners when captured by domtoimage.toBlob(). Override border-radius and border to 0/none during capture to produce a clean square image. Co-authored-by: Aditya Gaurav <aditya-ai-architect@users.noreply.github.com>
This commit is contained in:
@@ -61,9 +61,14 @@
|
|||||||
const containerSize = cropContainer.offsetWidth;
|
const containerSize = cropContainer.offsetWidth;
|
||||||
|
|
||||||
// Capture the crop container which maintains 1:1 aspect ratio
|
// Capture the crop container which maintains 1:1 aspect ratio
|
||||||
|
// Override border-radius and border to avoid transparent corners from rounded-full
|
||||||
const blob = await domtoimage.toBlob(cropContainer, {
|
const blob = await domtoimage.toBlob(cropContainer, {
|
||||||
width: containerSize,
|
width: containerSize,
|
||||||
height: containerSize,
|
height: containerSize,
|
||||||
|
style: {
|
||||||
|
borderRadius: '0',
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (await hasTransparentPixels(blob)) {
|
if (await hasTransparentPixels(blob)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user