Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize for alternate storage backends #329

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

damianmoore
Copy link

At the digital agency I work for we use Amazon's S3 for our image storage in production. We found your optimization post-processor and it worked well in development. However, when we went live we noticed the images were no longer being optimised.

The Django package we use is called django-storages: http://django-storages.readthedocs.org/en/latest/index.html

After digging into the post_processor.py I found that thumbnail.path is not set for cloud-based storage providers and raises a NotImplementedError. In this case I detect the file-type from the url attribute and save the file referenced by the name attribute.

I confirm this is working with S3 but it should be generic enough to work with most other storage backends.

@SmileyChris
Copy link
Owner

Cheers for this, I think that we should add a test showing what's going on here.
Rather than just using os.path.splitext, how about using mimetypes.guess_type and splitting on /, taking the subtype. And we don't need to do it against .url -- .name should be enough

beathan added a commit to NarrativeContentGroup/easy-thumbnails that referenced this pull request Mar 20, 2015
bigjust pushed a commit to NarrativeContentGroup/easy-thumbnails that referenced this pull request Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants