From 4e42aa333de60c15e6b3f9a6bb2a66086d78730f Mon Sep 17 00:00:00 2001 From: Marc MAURICE Date: Sat, 17 Aug 2013 19:17:32 +0200 Subject: [PATCH] Plugin to render thumbs as squares --- plugins/_disabled/squares/functions.php | 69 +++++++++++++++++++++++++++++++ plugins/_disabled/squares/style.css | 13 ++++++ template.php | 6 +++ 3 files changed, 88 insertions(+) create mode 100644 plugins/_disabled/squares/functions.php create mode 100644 plugins/_disabled/squares/style.css diff --git a/plugins/_disabled/squares/functions.php b/plugins/_disabled/squares/functions.php new file mode 100644 index 0000000..0c58481 --- /dev/null +++ b/plugins/_disabled/squares/functions.php @@ -0,0 +1,69 @@ + $h) { + $srcSize = $h; + $srcY = 0; + $srcX = ($w - $srcSize)/2; + } elseif ($w < $h) { + $srcSize = $w; + $srcX = 0; + $srcY = ($h - $srcSize)/2; + } else { + $srcSize = $w; + $srcX = $srcY = 0; + } + + $newImg = imagecreatetruecolor(THUMB_SIZE, THUMB_SIZE); + + imagecopyresampled($newImg, $img, 0, 0, $srcX, $srcY, THUMB_SIZE, THUMB_SIZE, $srcSize, $srcSize); + + if ($ext == ".jpg") + imagejpeg($newImg, $newImgFile); + else + imagepng($newImg, $newImgFile); + + imagedestroy($img); + imagedestroy($newImg); + } + + return $newImgFile; +} + + +?> diff --git a/plugins/_disabled/squares/style.css b/plugins/_disabled/squares/style.css new file mode 100644 index 0000000..4fbf695 --- /dev/null +++ b/plugins/_disabled/squares/style.css @@ -0,0 +1,13 @@ +#images .square { + display: block; + float: left; + margin: 1px; +} +#images .image { + display: block; +} +#images { + overflow: hidden; + clear: both; + margin-bottom: 1ex; +} diff --git a/template.php b/template.php index 1d0b4bc..1508f8b 100644 --- a/template.php +++ b/template.php @@ -56,6 +56,7 @@ a { +
@@ -68,15 +69,20 @@ a {
+
+
+
+
+
-- 1.7.10.4