Solution
@app.route('/')
def hello_world():
#filenames = os.listdir('static')
filenames = ['1.jpg', '2.jpg']
return render_template('index.html', filenames=filenames)
{% for name in filenames %}
{% endfor %}
@app.route('/')
def hello_world():
#filenames = os.listdir('D:\\1111')
#filenames = [os.path.join('D:\\1111', name) for name in filenames]
filenames = ['D:\\1111\\1.jpg', 'D:\\1111\\2.jpg']
images = []
for img_path in filenames:
img_stream = return_img_stream(img_path)
images.append(img_stream)
return render_template('index.html', images=images)
{% for img in images %}
{% endfor %}
@app.route('/')
def hello_world():
#filenames = os.listdir('D:\\1111')
#filenames = [os.path.join('D:\\1111', name) for name in filenames]
filenames = ['D:\\1111\\1.jpg', 'D:\\1111\\2.jpg']
images = []
for img_path in filenames:
img_stream = return_img_stream(img_path)
images.append( [img_stream, img_path ])
return render_template('index.html', images=images)
{% for img, txt in images %}
filename: {{ txt }}
{% endfor %}
{% for img, txt in images %}
filename: {{ txt }}
{% endfor %}