diff --git a/distribusi/distribusi/distribusi.py b/distribusi/distribusi/distribusi.py
index 1634180..f6eb696 100644
--- a/distribusi/distribusi/distribusi.py
+++ b/distribusi/distribusi/distribusi.py
@@ -17,6 +17,9 @@ from distribusi import fragments
import uuid
from distribusi.ignore import Ignore
+import traceback
+import json
+
MIME_TYPE = magic.Magic(mime=True)
ignore = Ignore()
@@ -39,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:
@@ -79,6 +83,7 @@ def thumbnail(image, name, args):
"
{}"
).format(name, data_url, cap)
except Exception as e:
+ traceback.print_exc()
print('Thumbnailer:', e)
return "
{}".format(name, name, name)
@@ -198,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/distribusi/distribusi/page_template_event.py b/distribusi/distribusi/page_template_event.py
index 646c0c1..9eb4ce8 100644
--- a/distribusi/distribusi/page_template_event.py
+++ b/distribusi/distribusi/page_template_event.py
@@ -18,8 +18,10 @@ html_head_event = """
%s
+
+
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
diff --git a/test_data/src/scripts/updateEventList.js b/test_data/src/scripts/updateEventList.js
index bd14272..453054e 100644
--- a/test_data/src/scripts/updateEventList.js
+++ b/test_data/src/scripts/updateEventList.js
@@ -13,26 +13,36 @@ ed_resquest.onload = function() {
event_list = ed_resquest.response;
console.log(event_list)
- for (let key in event_list){
- console.log(key);
- // convert date format( `.` -> `/` )
- let event = event_list[key];
- let date = event.date.split('.');
- date.pop();
- let date_str = date.join(' /');
-
- let row = document.createElement('div');
- row.classList.add("event_row")
- row.innerHTML = `${date_str} #${key} ${event.title}`
- let link = document.createElement('a');
- link.href = `${key}/`
- link.appendChild(row)
-
- document.getElementById("about_wrapper").appendChild(link);
- // TODO: add hover effect
- // TODO: add
- }
+ Object.entries(event_list)
+
+ .sort(function(a, b) {
+ return a[1].number < b[1].number
+ })
+
+ .forEach(function(item) {
+ console.log(item);
+
+ //
+ let key = item[0];
+ let event = item[1];
+
+ // convert date format( `.` -> `/` )
+ let date = event.date.split('.');
+ date.pop();
+ let date_str = date.join(' /');
+
+ let row = document.createElement('div');
+ row.classList.add("event_row")
+ row.innerHTML = `${date_str} #${key} ${event.title}`
+ let link = document.createElement('a');
+ link.href = `${key}/`
+ link.appendChild(row)
+
+ document.getElementById("about_wrapper").appendChild(link);
+ // TODO: add hover effect
+ // TODO: add
+ })
}