|
|
@ -2,19 +2,20 @@ |
|
|
|
"""gallery-html - generate thumbnails and print html for images |
|
|
|
|
|
|
|
Usage: |
|
|
|
gallery-html [--source=<pattern>...] [--output <dir>] [--base_url <url>] [-x <n>] [-y <n>] [--json] [--overwrite] |
|
|
|
gallery-html [--source <pattern>...] [--output <dir>] [--base_url <url>] [-x <n>] [-y <n>] [--json <filename>] [--html <filename>] [--overwrite] |
|
|
|
gallery-html (-h | --help) |
|
|
|
gallery-html (-v | --version) |
|
|
|
|
|
|
|
Options: |
|
|
|
-h --help Show this screen |
|
|
|
--json Render JSON output instead of HTML |
|
|
|
--source <pattern> Source directory or image file(s) to make gallery from |
|
|
|
--output <dir> Parent directory on local filesystem for thumbnails |
|
|
|
--base_url <url> Base URL for images |
|
|
|
-x <n> Maximum width of thumbnails in pixels |
|
|
|
-y <n> Maximum height of thumbnails in pixels |
|
|
|
--json <filename> Render JSON output to filename |
|
|
|
--html <filename> Render HTML output to filename |
|
|
|
--overwrite Replace existing thumbnail files |
|
|
|
--base_url=<url> Base URL for images |
|
|
|
--output=<dir> Path on local filesystem for images and thumbs |
|
|
|
--source=<pattern> Source directory or image file(s) to make gallery from |
|
|
|
-x=<n> Maximum width of thumbnails in pixels |
|
|
|
-y=<n> Maximum height of thumbnails in pixels |
|
|
|
-h --help Show this screen |
|
|
|
-v --version Display version |
|
|
|
""" |
|
|
|
|
|
|
@ -47,10 +48,14 @@ if __name__ == '__main__': |
|
|
|
else: |
|
|
|
gh.add_images_from('.') |
|
|
|
|
|
|
|
# JSON data if requested, HTML otherwise. |
|
|
|
# Write JSON data if requested: |
|
|
|
if args['--json']: |
|
|
|
gh.print_images_json() |
|
|
|
else: |
|
|
|
gh.print_images_html() |
|
|
|
with open(args['--json'], 'w') as f: |
|
|
|
f.write(gh.images_json()) |
|
|
|
|
|
|
|
# Write HTML data if requested: |
|
|
|
if args['--html']: |
|
|
|
with open(args['--html'], 'w') as f: |
|
|
|
f.write(gh.images_html()) |
|
|
|
|
|
|
|
sys.exit() |