siteposter

This commit is contained in:
j 2011-08-23 22:51:57 +02:00
parent 01056cbc5e
commit 0173e9ee40
2 changed files with 2 additions and 1 deletions

View file

@ -23,7 +23,7 @@ urlpatterns = patterns("item.views",
#poster #poster
(r'^(?P<id>[A-Z0-9].+)/poster(?P<size>\d+)\.jpg$', 'poster'), (r'^(?P<id>[A-Z0-9].+)/poster(?P<size>\d+)\.jpg$', 'poster'),
(r'^(?P<id>[A-Z0-9].+)/siteposter(?P<size>\d+)\.jpg$', 'siteposter'), (r'^(?P<id>[A-Z0-9].+)/siteposter(?P<size>\d*)\.jpg$', 'siteposter'),
(r'^(?P<id>[A-Z0-9].+)/poster\.jpg$', 'siteposter'), (r'^(?P<id>[A-Z0-9].+)/poster\.jpg$', 'siteposter'),
(r'^(?P<id>[A-Z0-9].+)/frameposter(?P<position>\d+).jpg$', 'poster_frame'), (r'^(?P<id>[A-Z0-9].+)/frameposter(?P<position>\d+).jpg$', 'poster_frame'),

View file

@ -604,6 +604,7 @@ def siteposter(request, id, size=None):
poster = item.path('siteposter.jpg') poster = item.path('siteposter.jpg')
poster = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster)) poster = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
if size: if size:
size = int(size)
image = Image.open(poster) image = Image.open(poster)
image_size = max(image.size) image_size = max(image.size)
if size < image_size: if size < image_size: