Reputation: 2422
How to show a image in a table !!
I am trying to show an image in a table, but it is coming blank !
This is my html/twig code --
<td>
<div style="background-image: url('{% if content.image_url is defined %}/imagex/{{ content.image_url }}{% endif %}')"></div>
</td>
here {{ content.image_url }}
contains the image.
the output look like so ---
<tr class="">
<td><div style="background-image: url('/imagex/product-image-1-url')"></div></td>vb
</tr>
<tr class="">
<td><div style="background-image: url('/imagex/https://hello.com/6c26a/original.png')"></div></td>vb
</tr>
i have also tried like so ---
{% if content.image.url is defined %}/imagex/{{ content.image.base64url }}
But no luck !!!
Any one knows how to fix this issue !!
Upvotes: 1
Views: 102
Reputation: 43
try this
<table border="1" style="width:100%">
<tr>
<td>
<a href="//your link//"><img src="//image url//"></a>
</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Upvotes: 2