Properly processing non-existing images.

This commit is contained in:
Alexey Skobkin 2020-02-01 03:27:25 +03:00
parent d8f78d82de
commit 5df0266bb3
No known key found for this signature in database
GPG Key ID: 5D5CEF6F221278E7
2 changed files with 4 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class InvoiceGenerator
$new = [];
foreach ($paths as $key => $path) {
$new[$key] = file_get_contents(Kernel::getProjectRoot().'/'.$path);
$new[$key] = file_exists($path) ? file_get_contents(Kernel::getProjectRoot().'/'.$path) : null;
}
return $new;

View File

@ -111,10 +111,12 @@
<tr>
<td height="50px">{{ 'label_signature'|trans(locale) }}</td>
<td colspan="2" valign="bottom">
{% if images.signature is defined and images.signature is not empty %}
<img src="{{ images.signature|data_uri(mime='image/png') }}" alt="Signature">
{% endif %}
</td>
</tr>
{% if images.stamp is defined %}
{% if images.stamp is defined and images.stamp is not empty %}
<tr>
<td colspan="3">
<img src="{{ images.stamp|data_uri(mime='image/png') }}" alt="Stamp">