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
This commit is contained in:
Sam Minnee 2009-04-07 05:04:43 +00:00
parent 205e64eaf1
commit 13547d82a1

View File

@ -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');
}