Change pictures architecture, generate thumbs

This commit is contained in:
Théophile Bastian 2022-02-03 13:14:38 +01:00
parent 438a935ead
commit 591416852a
18 changed files with 51 additions and 12 deletions

View file

@ -5,6 +5,8 @@ disableHugoGeneratorInject: true
enableRobotsTXT: false
params:
picturesBase: "/pictures"
thumbBase: "/pictures/thumb"
sourceURL: "https://git.tobast.fr/tobast/georges"
siteLicenseURL: "https://www.gnu.org/licenses/gpl-3.0.en.html"
siteLicenseName: "GNU GPLv3"
@ -40,6 +42,11 @@ module:
target: i18n
- source: archetypes
target: archetypes
# Georges
- source: pictures/full
target: static/pictures
- source: pictures/thumb
target: static/pictures/thumb
# Blueimp Gallery
- source: contrib/blueimp-gallery/css
target: static/blueimp/css

View file

@ -8,26 +8,26 @@ georgespics:
osm: https://www.openstreetmap.org/#map=14/45.1612/5.9444
date: 2021-06-27
pics:
- path: img/georges/2021-06-pra1.jpg
- path: img/georges/2021-06-pra2.jpg
- path: img/georges/2021-06-pra3.jpg
- path: img/georges/2021-06-pra4.jpg
- path: 2021-06-pra1.jpg
- path: 2021-06-pra2.jpg
- path: 2021-06-pra3.jpg
- path: 2021-06-pra4.jpg
- name: Pen-Bé, Bretagne
osm: https://www.openstreetmap.org/#map=14/47.4205/-2.4575
date: 2021-07-05
pics:
- path: img/georges/2021-07-penbe1.jpg
- path: img/georges/2021-07-penbe2.jpg
- path: 2021-07-penbe1.jpg
- path: 2021-07-penbe2.jpg
- name: Mourèze, Hérault
osm: https://www.openstreetmap.org/#map=15/43.6191/3.3517
date: 2021-07-27
pics:
- path: img/georges/2021-07-moureze1.jpg
- path: 2021-07-moureze1.jpg
- name: Dent de Crolles, Alpes
osm: https://www.openstreetmap.org/#map=15/45.3105/5.8559
date: 2021-11-13
pics:
- path: img/georges/2021-11-crolles1.jpg
- path: img/georges/2021-11-crolles2.jpg
- path: img/georges/2021-11-crolles3.jpg
- path: 2021-11-crolles1.jpg
- path: 2021-11-crolles2.jpg
- path: 2021-11-crolles3.jpg
---

View file

@ -59,8 +59,8 @@
<div class="gallery">
{{ range .pics }}
<a href="{{ .path }}">
<img src="{{ .path }}" />
<a href="{{ $.Site.Params.picturesBase }}/{{ .path }}">
<img src="{{ $.Site.Params.thumbBase }}/{{ .path }}" />
</a>
{{ end }}
</div>

1
pictures/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
thumb

18
pictures/Makefile Normal file
View file

@ -0,0 +1,18 @@
FULLPICS = $(wildcard full/*.jpg)
THUMBS = $(patsubst full/%.jpg,thumb/%.jpg,$(FULLPICS))
THUMB_DIM = 400
THUMB_ASPECT_RATIO = 1:1
CONVERT_OPTIONS = -quality 75 -strip -interlace Plane +repage
all: $(THUMBS)
thumb/%.jpg: full/%.jpg
convert "$<" \
-resize '$(THUMB_DIM)x$(THUMB_DIM)^' \
-gravity "$$(./gravityof.sh "$<")" \
-crop "$(THUMB_ASPECT_RATIO)" \
$(CONVERT_OPTIONS) "$@"
clean:
rm -f $(THUMBS)

View file

Before

Width:  |  Height:  |  Size: 494 KiB

After

Width:  |  Height:  |  Size: 494 KiB

View file

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

View file

Before

Width:  |  Height:  |  Size: 518 KiB

After

Width:  |  Height:  |  Size: 518 KiB

View file

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 261 KiB

View file

Before

Width:  |  Height:  |  Size: 555 KiB

After

Width:  |  Height:  |  Size: 555 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

View file

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View file

Before

Width:  |  Height:  |  Size: 567 KiB

After

Width:  |  Height:  |  Size: 567 KiB

View file

Before

Width:  |  Height:  |  Size: 497 KiB

After

Width:  |  Height:  |  Size: 497 KiB

View file

Before

Width:  |  Height:  |  Size: 567 KiB

After

Width:  |  Height:  |  Size: 567 KiB

View file

@ -0,0 +1 @@
South-West

8
pictures/gravityof.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
path="$1"
gravity_path="gravity/$(basename "$path" .jpg).gravity"
if [ -f "$gravity_path" ]; then
read gravity < $gravity_path
fi
echo "${gravity:-center}"

4
pre-build.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
make -C pictures
make -C scss