Skip to content
Browse files

ENHANCEMENT Image -> SetWidth() and Image -> SetHeight() generate new…

… image when size is the same as the original file (fixes #5792)
  • Loading branch information...
1 parent 1c12a22 commit 627a2916f48af24d399ad6e06fe97cde117fc776 j.m.milmine committed with chillu Mar 18, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 model/Image.php
View
6 model/Image.php
@@ -159,15 +159,15 @@ function loadUploadedImage($tmpFile) {
}
public function SetWidth($width) {
- return $this->getFormattedImage('SetWidth', $width);
+ return $this->getWidth() == $width ? $this : $this->getFormattedImage('SetWidth', $width);
}
public function SetHeight($height) {
- return $this->getFormattedImage('SetHeight', $height);
+ return $this->getHeight() == $height ? $this : $this->getFormattedImage('SetHeight', $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) {

2 comments on commit 627a291

@beerbohmdo

You should change this to check the width of the image is greater than the given value, because currently smaller images are increased to a pixelated ugliness.

@beerbohmdo

You could parameterize that public function SetWidth($width, $increase = false)

Please sign in to comment.
Something went wrong with that request. Please try again.