haltakov / simple-photo-gallery

Beautiful and simple photo galleries that help you tell your story. Free and open-source.
https://haltakov.net/simple-photo-gallery
MIT License
194 stars 51 forks source link

Thumbnail is wrong when image name has multiple dot in filename #126

Closed elcolie closed 5 months ago

elcolie commented 1 year ago

Background:
I am running grid search of my A.I. generated pictures. My pictures contains multiple dots in filename. For example character_2.0_0.2_1.4000000000000001_8.png

Problem:
gallery-build omit the dot therefore my thumbnails are wrong. My thumbnails are sharing the same character_2.jpg

Expected Result:
gallery-build smart enough to understand gridsearch and not sharing the same thumbnail.

Root cause comes from here.

def get_thumbnail_name(thumbnails_path, photo_name):
    """
    Generates the full path to a thumbnail file
    :param thumbnails_path: Path to the folders where the thumbnails will be stored
    :param photo_name: Name of the original photo
    :return: Full path to the thumbnail file
    """
    photo_name_without_extension = os.path.basename(photo_name).split(".")[0]
    return os.path.join(thumbnails_path, photo_name_without_extension + ".jpg")

https://github.com/haltakov/simple-photo-gallery/blob/master/simplegallery/logic/variants/files_gallery_logic.py#L26

kroesche commented 6 months ago

I reproduced this

kroesche commented 6 months ago

testing fix on branch issue/126-extradots

kroesche commented 4 months ago

addressed in release 1.5.6