Answers for "how to get image in flask"

2

How to return images in flask response?

from flask import send_file

@app.route('/get_image')
def get_image():
    if request.args.get('type') == '1':
       filename = 'ok.gif'
    else:
       filename = 'error.gif'
    return send_file(filename, mimetype='image/gif')
Posted by: Guest on October-09-2021
1

how to get images on flask page

<img src="{{url_for('static', filename='MD.png')}}">
Posted by: Guest on July-16-2020
0

how to put a image in flask

<image src="{{url_for('static',filename = 'images/download.jpg')}}" >
Posted by: Guest on January-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language