diff --git a/distribusi/distribusi/distribusi.py b/distribusi/distribusi/distribusi.py index 7cf85b8..f6eb696 100644 --- a/distribusi/distribusi/distribusi.py +++ b/distribusi/distribusi/distribusi.py @@ -18,6 +18,7 @@ import uuid from distribusi.ignore import Ignore import traceback +import json MIME_TYPE = magic.Magic(mime=True) @@ -41,9 +42,10 @@ def caption(image): return caption -def thumbnail(image, name, args): +def thumbnail(image, name, args, size=(450,450)): + try: - size = (450, 450) + # size = (450, 450) im = Image.open(image) exif = None try: @@ -201,7 +203,14 @@ def render_dir(args, directory): if type_ == 'image': a = FILE_TYPES[type_].format(relative_path, c, c) if args.thumbnail: - a = thumbnail(full_path, relative_path, args) + thumbconf_path = "./{}/{}".format(root, "thumbconf.json") + size = (450, 450) + if os.path.isfile(thumbconf_path): + with open(thumbconf_path) as json_file: + json_data = json.load(json_file) + size = tuple(json_data['size']) + print("applying thumbconf.json: size: ", size) + a = thumbnail(full_path, relative_path, args, size) if args.no_filenames: c = "" if args.captions: diff --git a/test_data/.ignore b/test_data/.ignore index 97a206e..f6e4eda 100644 --- a/test_data/.ignore +++ b/test_data/.ignore @@ -12,4 +12,5 @@ style.css 404.html main.js .+.alt -events \ No newline at end of file +events +thumbconf.json \ No newline at end of file