Answers for "url_for image 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
3

how to add images in hml while using flask

<image src="{{url_for('static',filename = 'images/download.jpg')}}" >
<!--filename  = "path of your image in in static folder"-->
Posted by: Guest on June-07-2020

Code answers related to "url_for image flask"

Python Answers by Framework

Browse Popular Code Answers by Language