mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Image -> SetWidth() and Image -> SetHeight() generate new image when size is the same as the original file (fixes #5792)
This commit is contained in:
parent
1c12a226a3
commit
627a2916f4
@ -159,15 +159,15 @@ class Image extends File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function SetWidth($width) {
|
public function SetWidth($width) {
|
||||||
return $this->getFormattedImage('SetWidth', $width);
|
return $this->getWidth() == $width ? $this : $this->getFormattedImage('SetWidth', $width);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetHeight($height) {
|
public function SetHeight($height) {
|
||||||
return $this->getFormattedImage('SetHeight', $height);
|
return $this->getHeight() == $height ? $this : $this->getFormattedImage('SetHeight', $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetSize($width, $height) {
|
public function SetSize($width, $height) {
|
||||||
return $this->getFormattedImage('SetSize', $width, $height);
|
return (($this->getWidth() == $width) && ($this->getHeight() == $height)) ? $this : $this->getFormattedImage('SetSize', $width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetRatioSize($width, $height) {
|
public function SetRatioSize($width, $height) {
|
||||||
|
Loading…
Reference in New Issue
Block a user