You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
394 B
16 lines
394 B
from easy_thumbnails.files import get_thumbnailer
|
|
|
|
from config.settings.base import THUMBNAIL_ALIASES
|
|
|
|
|
|
def get_thumbnail(file, size='medium', request=None):
|
|
# try:
|
|
options = THUMBNAIL_ALIASES[''].get(size)
|
|
url = get_thumbnailer(file).get_thumbnail(options).url
|
|
if request:
|
|
return request.build_absolute_uri(url)
|
|
|
|
return url
|
|
|
|
# except:
|
|
# return file.url
|