Skip to content

Commit

Permalink
added .DS to gitignore and added the suggested refactor on the imgpro…
Browse files Browse the repository at this point in the history
…xy url path
  • Loading branch information
Seif-Mamdouh committed Aug 8, 2024
1 parent a559649 commit 1a6f9b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ models
tmp_base_model

server/src/local.rs

.DS_Store
10 changes: 5 additions & 5 deletions server/src/http_server/pages/blog/md/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use crate::AppConfig;

use urlencoding::encode;

fn generate_imgproxy_url(base_url: &str, image_url: &str, width: u32, height: u32) -> String {
fn generate_imgproxy_url(base_url: &str, image_url: &str, width: u32) -> String {
format!(
"{}/unsafe/rs:fit:{width}:{height}/plain/{}",
"{}/unsafe/rs:fit:{width}:0/plain/{}",
base_url,
encode(image_url)
)
Expand Down Expand Up @@ -308,9 +308,9 @@ impl IntoHtml for Image {

let base_url = "https://imgproxy-cja.fly.dev";

let small_url = generate_imgproxy_url(base_url, &img_src, 300, 300);
let medium_url = generate_imgproxy_url(base_url, &img_src, 600, 600);
let large_url = generate_imgproxy_url(base_url, &img_src, 1200, 1200);
let small_url = generate_imgproxy_url(base_url, &img_src, 300);
let medium_url = generate_imgproxy_url(base_url, &img_src, 600);
let large_url = generate_imgproxy_url(base_url, &img_src, 1200);

Ok(html! {
picture {
Expand Down

0 comments on commit 1a6f9b4

Please sign in to comment.