diff --git a/src/picture.py b/src/picture.py index 33d53ce..83d3276 100644 --- a/src/picture.py +++ b/src/picture.py @@ -17,6 +17,7 @@ class Picture(): def __init__(self, picture_path: Path, page = None, raw: Path|None = None, is_repertoried: bool = True): self._large: Path = picture_path self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg") + self._thumb: Path = Path(picture_path.get_absolute_path()[:-4] + "_thumb.jpg") self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") self._albums_file: Path = Path(picture_path.get_absolute_path()[:-4] + "_albums.txt") self._raw: Path|None = raw @@ -27,7 +28,6 @@ class Picture(): albums_name: list[str] = f.read() if (len(albums_name)): self._albums_name += albums_name.split("\n") - print(self._albums_name) else: self._albums_file.touch() if (config.CREATE_GENERAL_ALBUM): @@ -45,12 +45,22 @@ class Picture(): self.gen_small() return self._small + def get_thumb(self): + if not self._thumb.exist(): + self.gen_thumb() + return self._thumb + def get_large(self): return self._large def get_profile_file(self): return self._profile_file + def gen_thumb(self): + im = Image.open(self._large.get_absolute_path()) + im.thumbnail((500,500)) + im.save(self._thumb.get_absolute_path(), "JPEG") + def gen_small(self): im = Image.open(self._large.get_absolute_path()).convert("RGB") im.save(self._small.get_absolute_path(), quality=95, optimize=True) diff --git a/src/templates/album.jinja b/src/templates/album.jinja index 038d4d5..d19a8ae 100644 --- a/src/templates/album.jinja +++ b/src/templates/album.jinja @@ -10,7 +10,7 @@