利用sigal生成在线相册

参考文档:http://sigal.saimon.org/en/latest/

* 安装

执行pip install sigal就好,超简单。

* 初始化配置文件

在你的图片目录下,执行sigal init,就会在当前目录下生成一个配置文件sigal.conf.py,你可以根据个人喜好修改,需要关注以下红色标注的几个地方

# Gallery title. Can be set here or as the '--title' option of the `sigal

# build` command, or in the 'index.md' file of the source directory.

# The priority order is: cli option > settings file > index.md file

# title = "Sigal test gallery"

# ---------------------

# General configuration

# ---------------------

# Source directory. Can be set here or as the first argument of the `sigal

# build` command

source = 'taobaoMMT'

# Destination directory. Can be set here or as the second argument of the

# `sigal build` command (default: '_build')

# destination = '_build'

# Theme :

# - colorbox (default), galleria, photoswipe, or the path to a custom theme

# directory

theme = 'photoswipe'

# Author. Used in the footer of the pages and in the author meta tag.

# author = ''

# Use originals in gallery (default: False). If True, this will bypass all

# processing steps (resize, auto-orient, recompress, and any plugin-specific

# step).

# Originals will be symlinked if orig_link = True, else they will be copied.

use_orig = True

# ----------------

# Image processing (ignored if use_orig = True)

# ----------------

# Size of resized image (default: (640, 480))

#img_size = (800, 600)

# Show a map of the images where possible?

# This option only has an effect on the galleria theme for the while.

# The leaflet_provider setting allow to customize the tile provider (see

# https://github.com/leaflet-extras/leaflet-providers#providers)

# show_map = False

# leaflet_provider = 'OpenStreetMap.Mapnik'

# Pilkit processor used to resize the image

# (see http://pilkit.readthedocs.org/en/latest/#processors)

# - ResizeToFit: fit the image within the specified dimensions (default)

# - ResizeToFill: crop THE IMAGE it to the exact specified width and height

# - SmartResize: identical to ResizeToFill, but uses entropy to crop the image

# - None: don't resize

# img_processor = 'ResizeToFit'

# Autorotate images

# Warning: this setting is not compatible with `copy_exif_data` (see below),

# because Sigal can't save the modified Orientation tag (currently Pillow can't

# write EXIF).

# autorotate_images = True

# If True, EXIF data from the original image is copied to the resized image

# copy_exif_data = False

# Jpeg options

# jpg_options = {'quality': 85,

#                'optimize': True,

#                'progressive': True}

# --------------------

# Thumbnail generation

# --------------------

# Generate thumbnails

# make_thumbs = True

# Subdirectory of the thumbnails

# thumb_dir = 'thumbnails'

# Prefix and/or suffix for thumbnail filenames (default: '')

# thumb_prefix = ''

# thumb_suffix = '.tn'

# Thumbnail size (default: (200, 150))

# For the galleria theme, use 280 px for the width

# For the colorbox and photoswipe theme, use 200 px for the width

thumb_size = (280, 210)

# Crop the image to fill the box

# thumb_fit = True

# Delay in seconds to avoid black thumbnails in videos with fade-in

# thumb_video_delay = '0'

# Keep original image (default: False)

# keep_orig = True

# Subdirectory for original images

# orig_dir = 'original'

# Use symbolic links instead of copying the original images

orig_link = True

# Attribute of Album objects which is used to sort medias (eg 'title'). To sort

# on a metadata key, use 'meta.key'.

# albums_sort_attr = 'name'

# Reverse sort for albums

# albums_sort_reverse = False

# Attribute of Media objects which is used to sort medias. 'date' can be used

# to sort with EXIF dates, and 'meta.key' to sort on a metadata key (which then

# must exist for all images).

# medias_sort_attr = 'filename'

# Reverse sort for medias

# medias_sort_reverse = False

# Filter directories and files.

# The settings take a list of patterns matched with the fnmatch module on the

# path relative to the source directory:

# http://docs.python.org/2/library/fnmatch.html

ignore_directories = []

ignore_files = []

# -------------

# Video options

# -------------

# Video format

# specify an alternative format, valid are 'webm' (default) and 'mp4'

# video_format = 'webm'

# Webm options

# Options used in ffmpeg to encode the webm video. You may want to read

# http://ffmpeg.org/trac/ffmpeg/wiki/vpxEncodingGuide

# Be aware of the fact these options need to be passed as strings. If you are

# using avconv (for example with Ubuntu), you will need to adapt the settings.

# webm_options = ['-crf', '10', '-b:v', '1.6M',

#                '-qmin', '4', '-qmax', '63']

# MP4 options

# Options used to encode the mp4 video. You may want to read

# https://trac.ffmpeg.org/wiki/Encode/H.264

# mp4_options = ['-crf', '23' ]

# Size of resized video (default: (480, 360))

# video_size = (480, 360)

# -------------

# Miscellaneous

# -------------

# Write HTML files. If False, sigal will only process the images.

# write_html = True

# Name of the generated HTML files

# output_filename = 'index.html'

# Add output filename (see above) to the URLs

# index_in_url = False

# Use CDN for assets (Google fonts, JQuery).

# If False some fonts may not be available.

# use_assets_cdn = True

# A list of links (tuples (title, URL))

# links = [('Example link', 'http://example.org'),

#          ('Another link', 'http://example.org')]

# Google Analytics tracking code (UA-xxxx-x)

# google_analytics = ''

# Google Tag Manager tracking code (GTM-xxxxxx)

# google_tag_manager = ''

# Piwik tracking

# tracker_url must not contain trailing slash.

# Example : {'tracker_url': 'http://stats.domain.com', 'site_id' : 2}

# piwik = {'tracker_url': '', 'site_id' : 0}

# Set zip_gallery to either False or a file name. The final archive will

# contain all resized or original files (depending on `zip_media_format`).

# zip_gallery = False  # False or 'archive.zip'

# zip_media_format = 'resized'  # 'resized' or 'orig'

# Specify a different locale. If set to '', the default locale is used.

# locale = ''

# List of files to copy from the source directory to the destination.

# A symbolic link is used if ``orig_link`` is set to True (see above).

# files_to_copy = (('extra/robots.txt', 'robots.txt'),

#                  ('extra/favicon.ico', 'favicon.ico'),)

# Colorbox theme config

# The column size is given in number of column of the css grid of the Skeleton

# framework which is used for this theme: http://www.getskeleton.com/#grid

# Then the image size must be adapted to fit the column size.

# The default is 4 columns which gives 220px. 3 columns gives 160px.

# colorbox_column_size = 4

# --------

# Plugins

# --------

# List of plugins to use. The values must be a path than can be imported.

# Another option is to import the plugin and put the module in the list, but

# this will break with the multiprocessing feature (the settings dict obtained

# from this file must be serializable).

# plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright',

#            'sigal.plugins.upload_s3', 'sigal.plugins.media_page']

# Add a copyright text on the image (default: '')

# copyright = "© An example copyright message"

# Adjust the image after resizing it. A default value of 1.0 leaves the images

# untouched.

# adjust_options = {'color': 1.0,

#                  'brightness': 1.0,

#                  'contrast': 1.0,

#                  'sharpness': 1.0}

# Settings for upload to s3 plugin

# upload_s3_options = {

# 'bucket': 'my-bucket',

# 'policy': 'public-read',

# 'overwrite': False

# }

* 执行生成指令

执行sigal build

* 预览效果(目录链接到nginx或者启动sigal server)

相册生成后,如果你有现成的web server,你可以选择将相册目录ln到web server的文档目录,这个很简单,

譬如,ln -s /home/blackcat/taobaoSpider/taobao/ /data/

也可以直接启动sigal自带的web server,在相册目录执行sigal serve

看一下效果,嘿嘿


©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,293评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,604评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,958评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,729评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,719评论 5 366
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,630评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,000评论 3 397
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,665评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,909评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,646评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,726评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,400评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,986评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,959评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,197评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 44,996评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,481评论 2 342

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,283评论 0 10
  • 如果要让我为自己的狂妄付出代价,那即便是死亡,也必将使我获得重生
    SupperRay阅读 210评论 0 1
  • 高效教师“高效”教学 第一招——提高课堂教学效率,精讲巧练为上上策。 教师的很多工作负担,都是因教师不充分利用课堂...
    刘春晖11阅读 141评论 0 0
  • 第一次听赵雷的理想是几年前,室友手机里放着,我静静的听着,当时只觉得这首歌好听,一听就是有故事的人。 现在,静下来...
    傻里傻气傻孩子阅读 114评论 0 0
  • 关于长平之战的几点思考 提起“长平之战”大家一般想到的就是那个只会“纸上谈兵”的赵括,是他,改变了老将的坚守战略改...
    蛮布证经阅读 407评论 1 1