From 7aa6f36e6df3fed026e7a802c79bd945bce9a8c4 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 24 Sep 2012 20:47:06 +0200 Subject: Show a placeholder image when no thumbnail could be fetched or generated. --- db.py | 2 +- fbin.py | 2 +- static/no-thumbnail.png | Bin 0 -> 1546 bytes templates/images.tmpl | 9 +++++++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 static/no-thumbnail.png diff --git a/db.py b/db.py index eaf5f13..8cadb6b 100644 --- a/db.py +++ b/db.py @@ -67,7 +67,7 @@ class File(Base): return self.get_mime_type().startswith('image') def image_html(self): - return u'{filename}'.format( + return u'{filename}'.format( root = settings.virtual_root, hash = self.hash, filename = self.filename, ext = os.path.splitext(self.filename)[1]) Base.metadata.create_all() diff --git a/fbin.py b/fbin.py index 726a87c..2bda843 100755 --- a/fbin.py +++ b/fbin.py @@ -429,7 +429,7 @@ class Application(object): def static(self, environ, start_response, path): filename = path[1] - if not filename in ('style.css',): + if not filename in ('style.css', 'no-thumbnail.png'): start_response('404 Not Found', []) return [] diff --git a/static/no-thumbnail.png b/static/no-thumbnail.png new file mode 100644 index 0000000..4af3517 Binary files /dev/null and b/static/no-thumbnail.png differ diff --git a/templates/images.tmpl b/templates/images.tmpl index 4cd3752..1dcfc46 100644 --- a/templates/images.tmpl +++ b/templates/images.tmpl @@ -1,6 +1,15 @@ #def title: images #def header: images #extends templates.base +#def head + +#end def #def content

You have $len($files) uploaded images totaling $total_size.