Skip to content

Image gallery goes empty if one picture is unreadable #141

@astukis

Description

@astukis

Describe the bug
The gallery sometimes shows an empty folder even though pictures exist on disk in static/gallery.

To Reproduce
Steps to reproduce the behavior:
1A) After taking a bunch of pictures system can produce some broken images due to various reasons.
1B) Upload a misformatted image to static/gallery manually, something that PIL library would fail to read.
2) Open the WebUI gallery page.
3) If just one saved picture is malformed/partial, the gallery renders as empty.

Expected behavior
If there are broken images in the gallery folder system should handle the exception, write something in logs and proceed showing all the other images that are fine.

Additional context
In app.py, the gallery listing logic (ImageGallery.getimagefiles()) attempts to open each .jpg using Pillow (Image.open(...)) to read dimensions; if one file can’t be decoded, the function logs Error loading image files and returns an empty result, so the whole gallery appears empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions