Browse Source

Generate thumbnails

master
parent
commit
dfef33b5d8
4 changed files with 14 additions and 3 deletions
  1. +3
    -0
      .gitignore
  2. +8
    -2
      Makefile
  3. +2
    -0
      source/content/thumbnails/README
  4. +1
    -1
      source/index.html.erb

+ 3
- 0
.gitignore View File

@@ -17,3 +17,6 @@
# Ignore .DS_store file
.DS_Store
source/tag/

# These are generated
source/content/thumbnails/*.*

+ 8
- 2
Makefile View File

@@ -1,13 +1,19 @@
ALL_TAGS = $(shell ruby -rutils -rset -I. -e 'print picture_info_hashes.reduce(Set.new) {|memo, h| memo + h[:tags]}.to_a.join(" ")')

all: tags
all: tags thumbnails
middleman build

tags:
rm -rf source/tag && mkdir source/tag
for tag in $(ALL_TAGS); do mkdir source/tag/$$tag && sed "s/%TAG%/$$tag/g" tag.html.erb >source/tag/$$tag/index.html.erb; done

thumbnails:
rm -f source/content/thumbnails/*.jpg source/content/thumbnails/*.png
for ext in jpg png; do \
for i in source/content/*.$$ext; do convert -define jpeg:size=800x800 $$i -thumbnail 295x380^ -gravity center -extent 295x380 `dirname $$i`/thumbnails/`basename $$i`; done; \
done

sync: all
rsync -r build/ drawings.hcoder.org:/var/www/virtual/drawings.hcoder.org/html/

.PHONY: all tags sync
.PHONY: all tags thumbnails sync

+ 2
- 0
source/content/thumbnails/README View File

@@ -0,0 +1,2 @@
This is where the thumbnails are generated after running "make" or
"make thumbnails".

+ 1
- 1
source/index.html.erb View File

@@ -6,7 +6,7 @@ active_menu_item: index
<% picture_info.each do |picture| %>
<article class="post tag-photo tag-music post__wrapper" data-cols="4">
<div class="post__wrapper_helper post__wrapper_helper--notloaded el__transition">
<p><img src="/content/<%= picture[:name] %>" alt="featured-image" /></p>
<p><img src="/content/thumbnails/<%= picture[:name] %>" alt="featured-image" /></p>

<div data-lightbox-label-for="<%= picture[:id] %>" class="post__preview el__transition">
<p class="post__excerpt"><a id="<%= picture[:id] %>" data-lightbox="drawings" href="/content/<%= picture[:name] %>" class="post__link post__title_link"><span><%= picture[:description] %></span></a></p>


Loading…
Cancel
Save