This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more s3 info and feincms_thumbnail override
- Loading branch information
Simon Baechler
committed
Jan 15, 2015
1 parent
328b174
commit dd85e3c
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# coding: utf-8 | ||
""" | ||
Thumbnailer class for FeinCMS. | ||
Allows using sorl thumbnail as default thumbnailer. | ||
Use this if you have mediafiles stored on S3. | ||
Add this line to your settings: | ||
FEINCMS_MEDIALIBRARY_THUMBNAIL = 'feincms_sorl_thumbnailer.thumbnailer' | ||
""" | ||
from __future__ import unicode_literals | ||
from sorl.thumbnail import get_thumbnail | ||
|
||
|
||
def thumbnailer(mediafile, dimensions='100x100', quality=65, **kwargs): | ||
""" | ||
Function called by FeinCMS medialibrary.thumbnail.admin_thumbnail | ||
:param mediafile: - the mediafile object | ||
:param kwargs: - options passed to the thumbnailer | ||
:return: - URL of the thumbnail | ||
""" | ||
if mediafile.type == 'image': | ||
im = get_thumbnail(mediafile.file, dimensions, quality=quality) | ||
return im.url | ||
return '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters