【问题标题】:Rotated picture is not displayed in flask旋转的图片不显示在烧瓶中
【发布时间】:2020-06-04 02:54:09
【问题描述】:

原始图片上传并存储在一个目录中,然后显示在一个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度的按钮驻留时,它在网页中显示图片。下图也显示了目录中的图片

图片翻转按钮调用路线及功能是

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

问题是在文件资源管理器中图片正确转动,在烧瓶网页中仍然加载为原始图片。

感谢您的帮助

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-07-20
      • 2021-08-17
      • 2021-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多