简体   繁体   中英

Jinja2: Upload image with url

I've tried tried different solutions but none them worked properly for me

My problem: an image doesn't appear on display

Part of HTML template:

<th colspan="3" rowspan="3"><i class="img-div" style="image: url('{{image}}');"></i></th>

Another way with the same result

<th colspan="3" rowspan="3"><i img src= "{{image}} "></i></th>

Image example (dictionary because I will have more than one variable later):

test = {'image': 'https://cdn.myanimelist.net/images/anime/1221/114740.jpg'}

Result: page1 = Template(template) display(HTML(page1.render(test)))

What's wrong? How should I render image url?

I am expecting an image to appear on display

There seem to be a few issues with the HTML code you provided.

can you try this?

<img src="{{image}}">

or:

<img src="{{image}}" width="100" height="100">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM