jazzband / sorl-thumbnail

Thumbnails for Django
https://sorl-thumbnail.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.74k stars 497 forks source link

Ability to select different storages from source and destination #631

Open submarcos opened 4 years ago

submarcos commented 4 years ago

Hi, I am user of sorl-thumbnail and it's very usefull.

In particular project and storage config case, we choose to store data in an s3 backend signed and private. I have no problem with default storage (media, s3, public), thumbnails are generated as well.

I have problem to generate thumbnail in another storage backend than Media, because there is no way to select Source storage.

Ex :

https://github.com/jazzband/sorl-thumbnail/blob/master/sorl/thumbnail/base.py#L74

It is ok if I set custom backend by overriding ThumbnailBackend -> get_thumbnail method

I need to replace ImageFile(file) with ImageFile(file, storage=get_storage()), where get_storage() is function returning my specific storage.

Do you think it is possible to integrate this functionality without rewrite all this function ? (adding argument etc)

It would be better if we could to choose source and destination backend as wanted.

I have no problem with my custom backend, but I need to rewrite and test all method whereas just this line should be overrided

Thank you for your advice

submarcos commented 4 years ago

I try to play with THUMBNAIL_STORAGE, but it's same problem