python - How can change or override sorl-thumbnail cache path and add image with absolute path? -


i have , mediaservice website , file storage in other folder media folder , want cache thumbnails in other folder, how can change sorl-thumbnail cache folder , how can give image absolute path make thumbnail ?

take @ the class responsible naming thumbnails produced sorl-thumbnail.

you subclass , use custom class thumbnail backend:

# in settings.py: thumbnail_backend = 'path.to.mythumbnailbackend'   #some module, in 1 of yours apps: sorl.thumbnail.base import thumbnailbackend sorl.thumbnail.conf import settings sorl.thumbnail.helpers import tokey, serialize  class mythumbnailbackend(thumbnailbackend):     def _get_thumbnail_filename(self, source, geometry_string, options):         """         computes destination filename.         """         key = tokey(source.key, geometry_string, serialize(options))         # make subdirs         path = '%s/%s/%s' % (key[:2], key[2:4], key)         return '%s%s.%s' % (settings.thumbnail_prefix, path,                             extensions[options['format']]) 

the previous snippet original code of _get_thumbnail_filename. can tweak code generate name @ convenience.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -