respondcreate / django-versatileimagefield

A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for quickly creating new images from the one assigned to the field.
http://django-versatileimagefield.readthedocs.io/
MIT License
531 stars 88 forks source link

Update BytesIO size instead of None when initialize InMemoryUploadedFile #129

Closed jxltom closed 6 years ago

jxltom commented 6 years ago

By default, InMemoryUploadedFile's size is None and calling len function will raise TypeError: 'NoneType' object cannot be interpreted as an integer error.

This PR assigns actual size for InMemoryUploadedFile and then len can be called in later postprocess such as uploading to s3 or other remote storage.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 349417922ca2771e4d12a4a70907d03eb3b1b5f2 on jxltom:update-InMemoryUploadedFile-size into d46f05626bce1327886bb9673e533ba8206d8da9 on respondcreate:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 98c292a8f071d495d788aa1f35b632c9bcaaf603 on jxltom:update-InMemoryUploadedFile-size into d46f05626bce1327886bb9673e533ba8206d8da9 on respondcreate:master.

respondcreate commented 6 years ago

Thanks for this PR, @jxltom, a much smarter implementation than what I had previously...I appreciate it!

jxltom commented 6 years ago

Glad to contribute :smile:

respondcreate commented 6 years ago

Hey @jxltom !

My apologies for taking so much time to get this into a proper PyPI release but it's finally included as part of the 1.10 release. Here's how you can get it:

$ pip install django-versatileimagefield==1.10

Thanks again for your stellar contribution to this library, I appreciate it!

jxltom commented 6 years ago

Thank you :smiley: @respondcreate