Update gallery_app.py

This commit is contained in:
2026-01-19 22:29:48 +01:00
parent 246b78719e
commit 8fc8372a9b

View File

@@ -221,7 +221,8 @@ def render_sidebar():
def render_gallery(): def render_gallery():
grid_container.clear() grid_container.clear()
batch = get_current_batch() batch = get_current_batch()
thumb_size = int(1800 / state.grid_cols) # High resolution for grid to allow scaling
thumb_size = 600
with grid_container: with grid_container:
with ui.grid(columns=state.grid_cols).classes('w-full gap-3'): with ui.grid(columns=state.grid_cols).classes('w-full gap-3'):
@@ -237,11 +238,11 @@ def render_gallery():
ui.button(icon='delete', on_click=lambda p=img_path: action_delete(p)).props('flat size=sm dense color=red') ui.button(icon='delete', on_click=lambda p=img_path: action_delete(p)).props('flat size=sm dense color=red')
# --- FIXED IMAGE RENDERING --- # --- FIXED IMAGE RENDERING ---
# 1. Increased height to h-64 (256px) for better visibility # aspect-[4/3]: Height scales with width.
# 2. Changed object-cover to object-contain (NO CROPPING) # object-contain: Shows FULL image (no crop), adds black bars if needed.
# 3. Added bg-black to fill empty space nicely
ui.image(f"/thumbnail?path={img_path}&size={thumb_size}&q={state.preview_quality}") \ ui.image(f"/thumbnail?path={img_path}&size={thumb_size}&q={state.preview_quality}") \
.classes('w-full h-64 object-contain bg-black rounded') \ .classes('w-full aspect-[4/3] object-contain bg-black rounded') \
.style('aspect-ratio: 4/3') \
.props('no-spinner') .props('no-spinner')
# Actions # Actions