This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wagtail.images.forms import BaseImageForm | |
from .image_utils import resize | |
class ImageForm(BaseImageForm): | |
# store user in __init__ and set default position of watermark | |
def __init__(self, data=None, files=None, **kwargs): | |
file = files and files.get('file', None) | |
already_resized = kwargs.pop('already_resized', False) | |
if not already_resized and file: | |
new_file = resize(file, file.field_name, file.name, file.content_type) |