mirror of
https://github.com/processwire/processwire.git
synced 2025-08-14 02:34:24 +02:00
Add @horst-n fix for ImageSizerEngine rounding issue processwire/processwire-issues#191
This commit is contained in:
@@ -623,6 +623,10 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
||||
$pWidth = $this->getProportionalWidth($targetHeight);
|
||||
}
|
||||
|
||||
// rounding issue fix via @horst-n for #191
|
||||
if($targetWidth == $originalTargetWidth && 1 + $targetWidth == $pWidth) $pWidth = $pWidth - 1;
|
||||
if($targetHeight == $originalTargetHeight && 1 + $targetHeight == $pHeight) $pHeight = $pHeight - 1;
|
||||
|
||||
if(!$this->upscaling) {
|
||||
// we are going to shoot for something smaller than the target
|
||||
|
||||
@@ -1083,7 +1087,7 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
||||
$this->setFlip($value);
|
||||
break;
|
||||
case 'useUSM':
|
||||
$this->setUseUsm($value);
|
||||
$this->setUseUSM($value);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1406,8 +1410,6 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
||||
$this->fullHeight = $this->image['height'];
|
||||
|
||||
if(0 == $this->finalWidth && 0 == $this->finalHeight) return false;
|
||||
if(0 == $this->finalWidth) $this->finalWidth = ceil(($this->finalHeight / $this->fullHeight) * $this->fullWidth);
|
||||
if(0 == $this->finalHeight) $this->finalHeight = ceil(($this->finalWidth / $this->fullWidth) * $this->fullHeight);
|
||||
|
||||
if($this->scale !== 1.0) { // adjust for hidpi
|
||||
if($this->finalWidth) $this->finalWidth = ceil($this->finalWidth * $this->scale);
|
||||
|
Reference in New Issue
Block a user