samedi 23 octobre 2021

Calling a python function when submitting using WTForms

I'm trying to implement an image compression script when an image for a profile is uploaded using WTForms. However, I've had a little trouble understanding how to set it up.

Here's my code:

    class Profile(FlaskForm):

        photo = FileField('Profile Picture')
        submit = SubmitField('Save Changes')
        def resize400(inputImg): *image compression code here*

Resize works by itself when I run it, so all I need is a image file input.




Aucun commentaire:

Enregistrer un commentaire