codelion commited on
Commit
9050e6b
·
verified ·
1 Parent(s): c58507e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -31,8 +31,10 @@ def generate_html_snippet(image_path_prefix):
31
  srcset_items = [f"{image_path_prefix}-{w}x{h}.jpg {w}w" for w, h in SIZES]
32
  srcset_str = ",\n ".join(srcset_items)
33
 
34
- # Using min-width for better responsive behavior
35
- sizes_str = "(min-width: 1000px) 45vw, (min-width: 780px) 696px, (min-width: 580px) 480px, calc(100vw - 60px)"
 
 
36
 
37
  # Use the middle size as default src
38
  default_size = SIZES[4] # 1280x1128
 
31
  srcset_items = [f"{image_path_prefix}-{w}x{h}.jpg {w}w" for w, h in SIZES]
32
  srcset_str = ",\n ".join(srcset_items)
33
 
34
+ sizes_items = [
35
+ f"(max-width: {w}px) {w}px" for w, _ in SIZES[:-1]
36
+ ] + [f"{SIZES[-1][0]}px"]
37
+ sizes_str = ",\n ".join(sizes_items)
38
 
39
  # Use the middle size as default src
40
  default_size = SIZES[4] # 1280x1128