django-private-storage icon indicating copy to clipboard operation
django-private-storage copied to clipboard

Add PrivateImageField

Open AndyLPK247 opened this issue 7 years ago • 3 comments

This is a request-for-enhancement: It would be really nice to have a PrivateImageField that borrows functionality from the standard ImageField class.

AndyLPK247 avatar Jul 10 '17 03:07 AndyLPK247

Agreed, that would be a nice addition! A patch for this feature is more then welcome!

vdboor avatar Jul 17 '17 12:07 vdboor

This is really amazing package for me. Please let me know if PrivateImageField will add? Thanks @vdboor and @AndyLPK247 for your effort :+1:

kamranhossain avatar Nov 08 '17 20:11 kamranhossain

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.

asfaltboy avatar Mar 13 '20 16:03 asfaltboy