summaryrefslogtreecommitdiff
path: root/animism-align/cli/commands/site
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/cli/commands/site')
-rw-r--r--animism-align/cli/commands/site/export.py14
1 files changed, 12 insertions, 2 deletions
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 = {