Skip to content

Commit 7a79c19

Browse files
authored
fix: avoid metaProportion calculation if image is not loaded or broken
closes #22
1 parent 749d315 commit 7a79c19

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Resources/views/storefront/utilities/thumbnail.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
{% endif %}
2020

2121
{% set metaProportion = media.metaData %}
22-
{% set ratio = (metaProportion.width / metaProportion.height)|round(2, 'floor') %}
22+
{% if metaProportion > 0 %}
23+
{% set ratio = (metaProportion.width / metaProportion.height)|round(2, 'floor') %}
24+
{% endif %}
2325

2426
{% if layout == 'full-width' %}
2527
{% if ratio >= 1 %}

0 commit comments

Comments
 (0)