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 = []; $new = [];
foreach ($paths as $key => $path) { 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; return $new;

View file

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