File upload uses flask-uploads plug-in, added a function to change the file name change_filename, now hopes to add a zoom function, custom width and height, only save the scaled image, the current code is as follows:
@admin.route("/post/new", methods=["GET", "POST"])
@login_required
def post_new():
form = PostForm()
if form.validate_on_submit():
title = form.title.data
photo_filename = change_filename(form.photo.data.filename)
photo = photos.save(form.photo.data, name=photo_filename)
post = Post(title=title, photo=photo)
db.session.add(post)
db.session.commit()
return redirect(url_for("admin.post_manage"))
return render_template("admin/post_new.html", form=form)
ask prawns how to write! Thank you!