django-private-storage
django-private-storage copied to clipboard
Add PrivateImageField
This is a request-for-enhancement: It would be really nice to have a PrivateImageField that borrows functionality from the standard ImageField class.
Agreed, that would be a nice addition! A patch for this feature is more then welcome!
This is really amazing package for me. Please let me know if PrivateImageField will add? Thanks @vdboor and @AndyLPK247 for your effort :+1:
btw, I defined this locally, is this what we're looking for?
class PrivateImageField(PrivateFileField, models.ImageField):
def __init__(self, *args, **kwargs):
kwargs['max_file_size'] = kwargs.get(
'max_file_size', settings.DEFAULT_MAX_FILE_SIZE
)
super().__init__(*args, **kwargs)
It works pretty well, but there are edge cases with regards to image transfer being required to get/set width/height attributes.