From 13547d82a14e1f66ee62c91ff5f582f9643e6534 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 7 Apr 2009 05:04:43 +0000 Subject: [PATCH] ENHANCEMENT Added SetSize() method to Image class so that we can call it from the template git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@74212 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Image.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/model/Image.php b/core/model/Image.php index b9ec18c5c..eb83b28a7 100755 --- a/core/model/Image.php +++ b/core/model/Image.php @@ -173,6 +173,10 @@ class Image extends File { return $this->getFormattedImage('SetWidth', $width); } + public function SetSize($width, $height) { + return $this->getFormattedImage('SetSize', $width, $height); + } + /** * Resize this Image by width, keeping aspect ratio. Use in templates with $SetWidth. * @return GD @@ -189,6 +193,14 @@ class Image extends File { return $gd->resizeByHeight($height); } + /** + * Resize this Image by both width and height, using padded resize. Use in templates with $SetSize. + * @return GD + */ + public function generateSetSize(GD $gd, $width, $height) { + return $gd->paddedResize($width, $height); + } + public function CMSThumbnail() { return $this->getFormattedImage('CMSThumbnail'); }