Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Update BaseDrawing.php #329

Merged
merged 1 commit into from
Jul 14, 2014
Merged

Update BaseDrawing.php #329

merged 1 commit into from
Jul 14, 2014

Conversation

sarciszewski
Copy link
Contributor

Avoid division by zero

Avoid division by zero
@CiTRO33
Copy link

CiTRO33 commented Mar 10, 2014

Hey, there is also a "bug" in this file:
the function setWidthAndHeight works only if resizeProportional is true:

in my opinion this must be work:

public function setWidthAndHeight($width = 0, $height = 0) {
if ($this->_resizeProportional && ! ($width == 0 || $height == 0)) {
$xratio = $width / $this->_width;
$yratio = $height / $this->_height;
if (($xratio * $this->_height) < $height) {
$this->_height = ceil ( $xratio * $this->_height );
$this->_width = $width;
} else {
$this->_width = ceil ( $yratio * $this->_width );
$this->_height = $height;
}
} else {
$this->_width = $width;
$this->_height = $height;
}
return $this;
}

MarkBaker pushed a commit that referenced this pull request Jul 14, 2014
@MarkBaker MarkBaker merged commit 311d03b into PHPOffice:develop Jul 14, 2014
@MarkBaker
Copy link
Member

Thanks

@Progi1984 Progi1984 modified the milestone: 1.8.0 Aug 26, 2014
@sarciszewski sarciszewski deleted the patch-2 branch December 29, 2014 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants