From: Marc MAURICE Date: Sat, 17 Aug 2013 17:17:32 +0000 (+0200) Subject: Plugin to render thumbs as squares X-Git-Tag: v1.7~8 X-Git-Url: http://positon.org/gitweb/?p=bizou.git;a=commitdiff_plain;h=4e42aa333de60c15e6b3f9a6bb2a66086d78730f Plugin to render thumbs as squares --- 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 {
+
+
+
+
+