diff --git a/README.md b/README.md
index e1d8680..0e92555 100644
--- a/README.md
+++ b/README.md
@@ -5,10 +5,12 @@ distbusi is a content management system for the web that produces static index p
##installation
-distribusi depends on `python-magic` 0.4+ to do automatic mime (filetype) detection
+distribusi depends on:
+* `python-magic` 0.4+ to do automatic mime (filetype) detection
+* `pillow` to generate thumbnails
using pip:
- sudo pip3 install python-magic
+ sudo pip3 install python-magic pillow
##usage
@@ -17,4 +19,12 @@ Make a distribusi of your home folder:
You will find that you now have an `index.html` in every folder.
+Create a quick gallery for the web:
+ python3 distribusi -d /path/to/my/photos -t
+
+This creates an `index.html` with `base64` encoded thumbnails
+
+Generate verbose output:
+ python3 distribusi -v
+
#✌
diff --git a/distribusi.py b/distribusi.py
index 27d9bee..32ea3e6 100755
--- a/distribusi.py
+++ b/distribusi.py
@@ -2,19 +2,31 @@
# -*- coding: iso-8859-15 -*-
#depends on python-magic 0.4
-import os, magic, argparse, sys
+import os, magic, argparse, sys, base64
from page_template import *
+from PIL import Image
+from io import BytesIO
parser = argparse.ArgumentParser("""
distbusi is a content management system for the web that produces static index pages based on folders in the filesystem. It is inspired by the automatic index functions featured in several web servers. It works by traversing the file system and directory hierarchy to automatically list all the files in the directory and providing them with html classes and tags for easy styling.
""")
parser.add_argument('-d', '--directory', help="Select which directory to distribute")
parser.add_argument('-v', '--verbose', help="Print verbose debug output", action="store_true")
+parser.add_argument('-t', '--thumbnail', help="Generate 150x150 thumbnails for images", action="store_true")
+
+#Todo:
+# build an 'undo' function that traverses the same directories and removes the index.html files
+# set the 'maxdepth'
+# toggle .folders
+
+
args = parser.parse_args()
if args.directory:
if args.verbose:
print('Generating directory listing for', args.directory)
+ if args.thumbnail:
+ print('Making thumbnails')
directory = args.directory
else:
directory = '.'
@@ -26,20 +38,26 @@ file_types = {'image':'', 'pdf':'