From bd2b083210e038f02bd8ee677c0e7772d372c3a0 Mon Sep 17 00:00:00 2001
From: Brett Parker <iDunno@sommitrealweird.co.uk>
Date: Sat, 22 Dec 2007 19:13:12 +0000
Subject: [PATCH] * Add support for bounding box based image resize * Remove
 related item from TODO list

---
 TODO         |  3 ---
 bpgallery.sh | 12 ++++++++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/TODO b/TODO
index 2d86dd2..c351507 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,2 @@
-* Allow a fixed height to be specified instead or as well as a fixed width, in
-  the latter case, resize to which ever fits the bounding box, but keep the
-  aspect ratio.
 * Allow ordering of images rather than the current "sort" based algorithm on
   filename.
diff --git a/bpgallery.sh b/bpgallery.sh
index d26821a..ade52a5 100755
--- a/bpgallery.sh
+++ b/bpgallery.sh
@@ -567,11 +567,19 @@ function generate_resized_images() {
 }
 
 function generate_thumbs() {
-	generate_resized_images $WIDTH $ICONSDIRECTORY
+	if [[ ! -z $HEIGHT ]]; then
+		generate_resized_images "${WIDTH}x${HEIGHT}" $ICONSDIRECTORY
+	else
+    	generate_resized_images $WIDTH $ICONSDIRECTORY
+	fi
 }
 
 function generate_medium() {
-	generate_resized_images $MEDIUMWIDTH $MEDIUMDIRECTORY
+	if [[ ! -z $MEDIUMHEIGHT ]]; then
+		generate_resized_images "${WIDTH}x${HEIGHT}" $MEDIUMDIRECTORY
+	else
+		generate_resized_images $MEDIUMWIDTH $MEDIUMDIRECTORY
+	fi
 }
 
 function generate_pages() {
-- 
2.39.5