ENHANCEMENT Added SetSize() to the Image class so we can use it in the templates

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61392 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-08-22 03:03:20 +00:00
parent 8505039954
commit c05ea7f653

View File

@ -171,6 +171,10 @@ class Image extends File {
return $this->getFormattedImage('SetWidth', $width); 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. * Resize this Image by width, keeping aspect ratio. Use in templates with $SetWidth.
* @return GD * @return GD
@ -187,6 +191,14 @@ class Image extends File {
return $gd->resizeByHeight($height); 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() { public function CMSThumbnail() {
return $this->getFormattedImage('CMSThumbnail'); return $this->getFormattedImage('CMSThumbnail');
} }