烧瓶中未显示旋转图片

时间:2020-06-04 02:54:09

标签: python html python-3.x flask flask-sqlalchemy

原始图片在html页面中显示后被上传并存储在目录中。路线是

@mod.route('/profile', methods=['GET'])
@login_required
def profile():
    form = UpdateProfileForm()
    if request.method == 'GET':
        form.username.data = current_user.username
        form.country.data = Paises.query.all()
        form.telephone.data = current_user.telephone
    image_file = url_for('static', filename='profile_pics/' + current_user.image_file)
    return render_template('profile.html', form=form, image_file=image_file)

当放置90度旋转按钮时,它将在网页中显示图片。下图也显示了目录中的图片

enter image description here

用于切换图片的按钮呼叫路线和功能

    path = 'static/profile_pics/'+filename
    i = Image.open(path)
    y, z = i.size
    i2 = i.rotate(90, expand=1)
    i2.save(path)

问题是在文件浏览器中图片正确旋转时,在烧瓶网页中图片仍按原样加载。

enter image description here

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

您是否重新启动了Flask应用程序?清除浏览器的缓存也可以。