Commits

Peter Ward  committed 09cc3da

more image types

  • Participants
  • Parent commits b933d92

Comments (0)

Files changed (1)

File shinypress/handlers/images.py

-import os.path
+from os import path
+from glob import glob
+
 from shinypress.jinja import env
-from glob import glob
 
 template = env.from_string(r"""
 %% for filename in images %%
 """)
 
 def render(directory):
-    directory = os.path.abspath(directory)
-    images = sorted(glob(os.path.join(directory, "*.jpg")))
+    directory = path.abspath(directory)
+    images = []
+    for pattern in ('*.jpg', '*.png'):
+        images.extend(
+            glob(path.join(directory, pattern))
+        )
+    images.sort()
     return (template.render(images=images), [])
 
 def render_single(image):