@@ -14,13 +14,22 @@ const {
1414const logo = sponsorLogos [sponsor .id ];
1515// Assuming logo.width and logo.height are known
1616const targetWidth = 400 ;
17- const aspectRatio = logo .width / logo .height ;
18- const targetHeight = targetWidth / aspectRatio ;
17+ const originalWidth = logo .width ;
18+ const originalHeight = logo .height ;
19+ const aspectRatio = originalWidth / originalHeight ;
20+
21+ let width = targetWidth ;
22+ let height = width / aspectRatio ;
23+
1924const maxHeight = 220 ;
20- const realHeight = targetHeight < maxHeight ? targetHeight : maxHeight ;
25+ if (height > maxHeight ) {
26+ height = maxHeight ;
27+ width = height * aspectRatio ; // adjust width to maintain aspect ratio
28+ }
29+
30+ const x = 650 - width / 2 ;
31+ const y = 650 - height / 2 ;
2132
22- const x = 650 - targetWidth / 2 ;
23- const y = 650 - realHeight / 2 ;
2433---
2534<svg width =" 900" height =" 900" class =" h-full w-full -z-10" >
2635 <image href =" /social/bg.png" width =" 900" height =" 900" />
@@ -50,11 +59,11 @@ const y = 650 - realHeight / 2;
5059 href ={ logo .src }
5160 x ={ x }
5261 y ={ y }
53- width ={ targetWidth }
54- height ={ realHeight }
55- style ={ {
56- padding: logo_padding ? logo_padding : undefined ,
57- }}
62+ width ={ width }
63+ height ={ height }
64+ style ={ {
65+ padding: logo_padding ? logo_padding : undefined ,
66+ }}
5867 clip-path =" url(#curvedCornerClip)"
5968 preserveAspectRatio =" xMidYMid meet"
6069/>
0 commit comments