summaryrefslogtreecommitdiff
path: root/animism-align
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align')
-rw-r--r--animism-align/cli/app/settings/app_cfg.py4
-rw-r--r--animism-align/cli/commands/site/export.py14
2 files changed, 15 insertions, 3 deletions
diff --git a/animism-align/cli/app/settings/app_cfg.py b/animism-align/cli/app/settings/app_cfg.py
index 5c468f5..963e265 100644
--- a/animism-align/cli/app/settings/app_cfg.py
+++ b/animism-align/cli/app/settings/app_cfg.py
@@ -119,8 +119,10 @@ TEXT_ANNOTATION_TYPES = [
IMAGE_UPLOAD_FIELDS = [
"display", "thumbnail",
+ # "fullsize",
]
IMAGE_UPLOAD_GALLERY_LOOKUPS = [
- "thumbnail_lookup", "display_lookup", "image_lookup",
+ "thumbnail_lookup", "display_lookup",
+ # "image_lookup",
]
diff --git a/animism-align/cli/commands/site/export.py b/animism-align/cli/commands/site/export.py
index a00ef0d..118afcd 100644
--- a/animism-align/cli/commands/site/export.py
+++ b/animism-align/cli/commands/site/export.py
@@ -113,8 +113,9 @@ def rewrite_db_media(db, fp_out, url_out):
# images - various sizes
settings = item['settings']
if item['type'] == 'image':
- for field in app_cfg.IMAGE_UPLOAD_FIELDS:
+ if 'fullsize' in settings:
del settings['fullsize']
+ for field in app_cfg.IMAGE_UPLOAD_FIELDS:
if field in settings:
settings[field] = rewrite_upload(to_copy, settings[field], fp_out, url_out)
# videos - poster images
@@ -123,6 +124,13 @@ def rewrite_db_media(db, fp_out, url_out):
settings['poster'] = rewrite_upload(to_copy, settings['poster'], fp_out, url_out)
# galleries - a bunch of lookups
elif item['type'] == 'gallery':
+ new_image_lookup = {}
+ for id in settings['image_order']:
+ id = str(id)
+ if id in settings['image_lookup']:
+ new_image_lookup[id] = rewrite_upload(to_copy, settings['image_lookup'][id], fp_out, url_out, png_only=True)
+ settings['image_lookup'] = new_image_lookup
+
for field in app_cfg.IMAGE_UPLOAD_GALLERY_LOOKUPS:
for id in settings['image_order']:
id = str(id)
@@ -134,7 +142,7 @@ def rewrite_db_media(db, fp_out, url_out):
settings['file'] = rewrite_upload(to_copy, settings['file'], fp_out, url_out)
return to_copy
-def rewrite_upload(to_copy, item, fp_out, url_out):
+def rewrite_upload(to_copy, item, fp_out, url_out, png_only=False):
"""
# rewriting uploads. they look like this:
"fn": "koester.gif",
@@ -145,6 +153,8 @@ def rewrite_upload(to_copy, item, fp_out, url_out):
"""
if 'sha256' not in item:
return item
+ if png_only and item['ext'] != '.png':
+ return
sha = item['sha256']
out_fn = sha + item['ext']
out_obj = {