This commit is contained in:
Hyunchul Kim 2021-12-01 21:22:18 +09:00
commit 0bf5da8bd1
4 changed files with 48 additions and 23 deletions

View file

@ -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):
"<figure><a href='{}'><img class='thumbnail' src='data:image/jpg;base64,{}'></a><figcaption>{}</figcaption></figure>"
).format(name, data_url, cap)
except Exception as e:
traceback.print_exc()
print('Thumbnailer:', e)
return "<figure><a href='{}'><img src='{}'></a><figcaption>{}</figcaption></figure>".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:

View file

@ -18,8 +18,10 @@ html_head_event = """
%s
<link rel="stylesheet" type="text/css" href="/src/style/common.css" />
<link rel="stylesheet" type="text/css" href="/src/style/event.css" />
<link rel="stylesheet" type="text/css" href="./style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="/src/scripts/mobileScroll.js"></script>
<script src="./main.js"></script>
</head>
<body>
<div>

View file

@ -13,3 +13,4 @@ style.css
main.js
.+.alt
events
thumbconf.json

View file

@ -13,11 +13,21 @@ ed_resquest.onload = function() {
event_list = ed_resquest.response;
console.log(event_list)
for (let key in event_list){
console.log(key);
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 event = event_list[key];
let date = event.date.split('.');
date.pop();
let date_str = date.join(' /');
@ -32,7 +42,7 @@ ed_resquest.onload = function() {
document.getElementById("about_wrapper").appendChild(link);
// TODO: add hover effect
// TODO: add
}
})
}