django1/django/parts/media/photos.py

7 lines
183 B
Python

import re
def get_thumbnail_url(photo_url, width):
bits = photo_url.split('/')
bits[-1] = re.sub(r'(?i)\.(gif|jpg)$', '_t%s.\\1' % width, bits[-1])
return '/'.join(bits)