Skip to content

Commit

Permalink
fix: improve opengraph images for mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Mar 7, 2024
1 parent b0a4920 commit b85f767
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ pub fn create_og_image(title: &str, description: &str, background_color: &str) -
let cloudinary_url = format!("https://res.cloudinary.com/{}/image/upload", cloudinary_id);

let title_encoded = format!(
"/l_text:{}_60_bold:{},co_rgb:000000,c_fit,w_1000,h_200",
"/l_text:{}_80_bold:{},co_rgb:000000,c_fit,w_1150",
utf8_percent_encode("Londrina Solid", NON_ALPHANUMERIC),
utf8_percent_encode(&title, NON_ALPHANUMERIC)
);

let description_encoded = format!(
"/l_text:{}_40:{},co_rgb:FFFFFF,c_fit,w_1000",
"/l_text:{}_55:{},co_rgb:FFFFFF,c_fit,w_1150",
utf8_percent_encode("Londrina Solid", NON_ALPHANUMERIC),
utf8_percent_encode(&description, NON_ALPHANUMERIC)
);
Expand All @@ -77,13 +77,13 @@ pub fn create_og_image(title: &str, description: &str, background_color: &str) -
&cloudinary_url,
&background_color,
"/c_scale,h_630,w_1200",
"/l_lil_noun_logo/c_scale,w_300/e_screen,fl_layer_apply,g_north,y_100",
"/l_lil_noun_logo/c_scale,w_200/e_screen,fl_layer_apply,g_north_west,x_25,y_100",
&title_encoded,
"/fl_layer_apply,g_south_west,x_100,y_230",
"/fl_layer_apply,g_north_west,x_25,y_200",
&description_encoded,
"/fl_layer_apply,g_south_west,x_100,y_70",
"/fl_layer_apply,g_north_west,x_25,y_380",
"/f_auto,q_auto:eco",
"/blank.png",
"/blank.jpg",
];

parts.join("")
Expand Down

0 comments on commit b85f767

Please sign in to comment.