0

Is it possible to resize image before upload using django filebrowser without keeping original image size on server ?

bizon
  • 125
  • 3
  • 10

1 Answers1

0

Create pre_upload callback that will resize your image before saving.

from filebrowser import signals

def pre_upload_callback(sender, **kwargs):
    """
    Receiver function called before an upload starts.
    """
    print "Pre Upload Callback"
    print "kwargs:", kwargs
    # your code HERE
signals.filebrowser_pre_upload.connect(pre_upload_callback)

Filebrowser documentation on signals

Alternatively, if pre_upload hook doesn't work (because the file is not there yet) you can use post_upload hook, and modify the file in place.

Lu.nemec
  • 484
  • 6
  • 10