fix: broken image rendering in print format
This commit is contained in:
parent
e111f353a4
commit
3bc1648939
2 changed files with 3 additions and 3 deletions
|
|
@ -126,14 +126,14 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}"
|
|||
{% include doc.print_templates[df.fieldname] %}
|
||||
{% elif df.fieldtype=="Check" %}
|
||||
<i class="{{ 'fa fa-check' if doc[df.fieldname] }}"></i>
|
||||
{% elif df.fieldtype in ("Image", "Attach Image") %}
|
||||
{% elif df.fieldtype in ("Image", "Attach Image") and frappe.utils.is_image(doc[doc.meta.get_field(df.fieldname).options]) %}
|
||||
<img src="{{ doc[doc.meta.get_field(df.fieldname).options] }}"
|
||||
class="img-responsive"
|
||||
{%- if df.print_width %} style="width: {{ get_width(df) }};"{% endif %}>
|
||||
{% elif df.fieldtype=="Signature" %}
|
||||
<img src="{{ doc[df.fieldname] }}" class="signature-img img-responsive"
|
||||
{%- if df.print_width %} style="width: {{ get_width(df) }};"{% endif %}>
|
||||
{% elif df.fieldtype == "Attach" and doc[df.fieldname] and frappe.utils.is_image(doc[df.fieldname]) %}
|
||||
{% elif df.fieldtype == "Attach" and frappe.utils.is_image(doc[df.fieldname]) %}
|
||||
<img src="{{ doc[df.fieldname] }}" class="img-responsive"
|
||||
{%- if df.print_width %} style="width: {{ get_width(df) }};"{% endif %}>
|
||||
{% elif df.fieldtype=="HTML" %}
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ def is_image(filepath):
|
|||
from mimetypes import guess_type
|
||||
|
||||
# filepath can be https://example.com/bed.jpg?v=129
|
||||
filepath = filepath.split('?')[0]
|
||||
filepath = (filepath or "").split('?')[0]
|
||||
return (guess_type(filepath)[0] or "").startswith("image/")
|
||||
|
||||
def get_thumbnail_base64_for_image(src):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue