git » galala.git » commit 4461d74

Allow the user to override the normal image size

author Alberto Bertogli
2013-05-27 22:24:44 UTC
committer Alberto Bertogli
2013-05-27 22:24:44 UTC
parent 9938c7b231694283ca02ef0476aa5b865a2db579

Allow the user to override the normal image size

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

common.py +4 -0
galala +1 -1

diff --git a/common.py b/common.py
index 31ffaa9..eafde29 100644
--- a/common.py
+++ b/common.py
@@ -67,6 +67,7 @@ class Page (object):
         self.title = ''
         self.introduction = ''
         self.albums = []
+        self.resize_to = 1200
 
 
 def page_save(page, path):
@@ -75,6 +76,7 @@ def page_save(page, path):
     c.add_section("page")
     c.set("page", "title", page.title.encode('utf8'))
     c.set("page", "introduction", page.introduction.encode('utf8'))
+    c.set("page", "resize_to", str(page.resize_to))
 
     # a list with the album names in order, so we preserve it since the
     # order of the sections could be lost
@@ -109,6 +111,8 @@ def page_load(path):
     p = Page()
     p.title = c.get("page", "title")
     p.introduction = c.get("page", "introduction")
+    if c.has_option("page", "resize_to"):
+        p.resize_to = c.getint("page", "resize_to")
     album_names = c.get("page", "album_names").split()
 
     albums = {}
diff --git a/galala b/galala
index 5582531..f0734bb 100755
--- a/galala
+++ b/galala
@@ -94,7 +94,7 @@ def generate(page_path, dst_path):
 
             # create normal-sized images using PIL
             if not os.path.exists(dst_path + '/' + i.normalpath):
-                resize_img(i.realpath, 1200, 1200,
+                resize_img(i.realpath, page.resize_to, page.resize_to,
                         dst_path + '/' + i.normalpath)