your personal website on atproto - mirror blento.app
25
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix safari compression issue

Florian 28b90eea eb7f3d61

+4 -2
+4 -2
src/lib/atproto/image-helper.ts
··· 49 49 if (!ctx) return reject(new Error('Failed to get canvas context.')); 50 50 ctx.drawImage(img, 0, 0, width, height); 51 51 52 - // Use WebP for both compression and transparency support 52 + // Use WebP if supported, fall back to JPEG (Safari doesn't support WebP encoding) 53 + const supportsWebP = canvas.toDataURL('image/webp').startsWith('data:image/webp'); 54 + const mimeType = supportsWebP ? 'image/webp' : 'image/jpeg'; 53 55 let quality = 0.9; 54 56 55 57 function attemptCompression() { ··· 71 73 attemptCompression(); 72 74 } 73 75 }, 74 - 'image/webp', 76 + mimeType, 75 77 quality 76 78 ); 77 79 }