Is it possible to resize image before upload using django filebrowser without keeping original image size on server ?
Asked
Active
Viewed 349 times
0
-
duplicate: http://stackoverflow.com/questions/15140483/django-imagefield-setting-a-fixed-width-and-hight – mortymacs Oct 04 '14 at 09:41
-
possible duplicate of [this](http://stackoverflow.com/questions/15519716/django-resize-image-during-upload) – Hasan Ramezani Oct 04 '14 at 09:41
-
[this](http://davedash.com/2009/02/21/resizing-image-on-upload-in-django/) may help you. – Hasan Ramezani Oct 04 '14 at 09:52
1 Answers
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