again division by zero

$this->_width and $this->_height are defined as float so !== will return TRUE also if the value is 0 ( as !== use OR )
This commit is contained in:
matteofilippetto 2014-07-22 17:40:31 +02:00
parent 87be8d3d8e
commit 38ff5a49f8

View File

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