我有一个flask应用程序,该应用程序从文本文件(包括jpg文件的名称)读取。我在图像文件夹中找到了jpeg文件。我正在尝试将jpg与数据框一起显示。
我尝试将jpeg的名称与“ img src”代码连接起来。但是它只是显示为字符串。
{% extends "layout.html" %}
{% block content %}
<div class="jumbotron">
<h1>Welcome to our Photo Page</h1>
<p>Please select one of the links from the nav bar.</p>
</div>
{{data | safe}}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Thumbnail Gallery</h1>
</div>
{{image_names}}
<hr>
{% for image_name in image_names %}
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<img class="img-responsive" src=" {{url_for('send_image', filename=image_name)}}">
</div>
{% endfor %}
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
crossorigin="anonymous"></script>
{% endblock %}
HTML代码:
{{1}}
期望在数据帧末尾看到jpeg,而不是作为字符串获取。