Commit a549c31e authored by fred's avatar fred
Browse files

use two underscores to mark thumbnail files

parent e712bfab
......@@ -17,7 +17,7 @@ def thumbnail(image, size='100x100'):
# defining the filename and the miniature filename
filehead, filetail = os.path.split(image.path)
basename, format = os.path.splitext(filetail)
miniature = basename + '_' + size + format
miniature = basename + '__' + size + format
filename = image.path
miniature_filename = os.path.join(filehead, miniature)
filehead, filetail = os.path.split(image.url)
......@@ -61,7 +61,7 @@ def clean_thumb(sender, instance, **kwargs):
if not hasattr(instance, 'image'):
return
name, ext = os.path.splitext(os.path.basename(instance.image.name))
exp = '^%s_\d+x\d+x[0-1]{1}\%s' % (name, ext)
exp = '^%s__\d+x\d+x[0-1]{1}\%s' % (name, ext)
for file_path in os.listdir(settings.MEDIA_ROOT):
if re.search(exp, file_path):
os.unlink(settings.MEDIA_ROOT + file_path)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment