Merge pull request #408 from matteofilippetto/develop

again division by zero
This commit is contained in:
Mark Baker 2014-07-22 22:57:52 +01:00
commit c3432f0ef7
1 changed files with 4 additions and 4 deletions

View File

@ -321,7 +321,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
public function setWidth($pValue = 0) { public function setWidth($pValue = 0) {
// Resize proportional? // Resize proportional?
if ($this->_resizeProportional && $pValue != 0) { if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_height / ($this->_width !== 0 ? $this->_width : 1); $ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
$this->_height = round($ratio * $pValue); $this->_height = round($ratio * $pValue);
} }
@ -349,7 +349,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
public function setHeight($pValue = 0) { public function setHeight($pValue = 0) {
// Resize proportional? // Resize proportional?
if ($this->_resizeProportional && $pValue != 0) { if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / ($this->_height !== 0 ? $this->_height : 1); $ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
$this->_width = round($ratio * $pValue); $this->_width = round($ratio * $pValue);
} }
@ -373,8 +373,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_BaseDrawing * @return PHPExcel_Worksheet_BaseDrawing
*/ */
public function setWidthAndHeight($width = 0, $height = 0) { public function setWidthAndHeight($width = 0, $height = 0) {
$xratio = $width / ($this->_width !== 0 ? $this->_width : 1); $xratio = $width / ($this->_width != 0 ? $this->_width : 1);
$yratio = $height / ($this->_height !== 0 ? $this->_height : 1); $yratio = $height / ($this->_height != 0 ? $this->_height : 1);
if ($this->_resizeProportional && !($width == 0 || $height == 0)) { if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
if (($xratio * $this->_height) < $height) { if (($xratio * $this->_height) < $height) {
$this->_height = ceil($xratio * $this->_height); $this->_height = ceil($xratio * $this->_height);