]> git.draconx.ca Git - homepage.git/blobdiff - Rules
Solar Eclipse in Ottawa on 2021-06-10.
[homepage.git] / Rules
diff --git a/Rules b/Rules
index d3247cb8e2be32b62a75789495b9ed79ae29c05e..26bcb40ac7b1a8f0dbe86ba9f22b5edbc44d6300 100644 (file)
--- a/Rules
+++ b/Rules
@@ -100,6 +100,7 @@ postprocess do
 
                 # Find output reps corresponding to this key, if any
                 item.reps.each do |rep|
+                    next if rep.raw_path.nil?
                     next unless
                         FileUtils.identical?(item.raw_filename, rep.raw_path)
 
@@ -179,11 +180,21 @@ compile '/license/cc*.xhtml' do
 end
 
 compile '/images/*.jpg', rep: :large do
+    w, h = FastImage.size(item.raw_filename)
     filename = item.identifier.without_ext + '-t1200.' + item.identifier.ext
-    filter :imgresize, width: 1200, height: 1200, cache: filename
+    filter :imgresize, width: [w, 1200].min, height: [h, 1200].min, cache: filename
     write filename
 end
 
+compile '/images/*.jpg', rep: :medium do
+    w, h = FastImage.size(item.raw_filename)
+    filename = item.identifier.without_ext + '-t800.' + item.identifier.ext
+    if w > 900 or h > 900
+        filter :imgresize, width: 800, height: 800, cache: filename
+        write filename
+    end
+end
+
 compile '/images/*.jpg', rep: :info do
     filter :imginfo
     layout '/imginfo.xsl'