Open ambroisemaupate opened 8 years ago
There is also a "Division by zero" Warning if using a combination of keep-ration and ignore-error for a non existing image.
An example: styles.xml `
`
image.pdf.twig `
`
The images doesn't exists.
Warning Message: Division by zero
see psliwa/php-pdf/lib/PHPPdf/Core/Node/Image.php at line 97
$sourceRatio = $sourceImage->getOriginalHeight() / $sourceImage->getOriginalWidth();
Quickfix for line 94
before:
if($keepRatio
after:
if($keepRatio && $sourceImage->getOriginalWidth())
Can you fix this booth issues in a new version, pls.
A divide by zero is occuring in
Util.php
on line 59 incalculateDependantSizes
method.When
ratio
is not set or null or 0.Could we throw an exception when this method parameters does not match requirements?
Moreover
$ratio
can be zero inImageConvertAttributesFormatter
line 40$originalRatio = $originalHeight ? $originalWidth/$originalHeight : 0;