From 1d87fa168f4c927319b71798856d28796f7aa135 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 24 Mar 2021 01:02:33 -0400 Subject: Initial commit --- .gitignore | 3 +++ README.md | 31 ++++++++++++++++++++++ bp | 36 +++++++++++++++++++++++++ index.html | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 bp create mode 100644 index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21bd3e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Images +*.jpg +*.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..25981f1 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +Ben's Photostream (BP) +====================== +Minimal static photo-gallery generator. + +Photo galleries on the web are quite bloated. They use more javascript than +they would need to accomplish something extremely simple: display images. BP +is a simple shell script which generates a static webpage displaying a photo +gallery using a given folder. Photos are displayed in a relatively +chronological order from the date of the images creation. + +Usage: +------ + ++ Set the `photodir` variable to the folder where your photos are stored. All +photos should be at the root of this folder as BP doesn't search for images +recursively. + ++ Set the `galleryfile` variable to the html file in which you want the gallery +to appear. + ++ Make sure your `galleryfile` has the following lines somewhere (not having +them will lead to this file being erased): + +``` + + + +``` + ++ For insight into how the css styling should be configured, please consult the +included `index.html` file diff --git a/bp b/bp new file mode 100755 index 0000000..74a76cd --- /dev/null +++ b/bp @@ -0,0 +1,36 @@ +#!/bin/sh + +photodir="stream" +galleryfile="index.html" + +bfile="$(sed '//q' $galleryfile )" +efile="$(sed '1,//d' $galleryfile )" + +perfour() { + # One out of every five lines: + batch="$(awk 'NR == 1 || NR % 5 == 0' - )" + # Add the html fluff: + list="$( + for i in $batch; do + base="$(echo "$i" | cut -f 1 -d "." )" + printf "\t\t\"$base\"\n" + done + )" + printf "\t
\n$list\n\t
" + +} + +all="$(ls -t $photodir)" +col1="$(echo "$all" | perfour)" +all="$(echo "$all" | sed '1d' )" +col2="$(echo "$all" | perfour)" +all="$(echo "$all" | sed '1d' )" +col3="$(echo "$all" | perfour)" +all="$(echo "$all" | sed '1d' )" +col4="$(echo "$all" | perfour)" + +gallery="$(printf "
\n$col1\n$col2\n$col3\n$col4\n
\n\n")" + +echo "$bfile +$gallery +$efile" > index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..e902ae4 --- /dev/null +++ b/index.html @@ -0,0 +1,88 @@ + + + + + + Photo Gallery - Chausse Benjamin + + +

My Photo Gallery

+

+ I like taking pictures every once in a while. Enjoy ;) +

+ + + + + + + + + + -- cgit v1.2.3