From 05ea9cf44d9666e134ce2ad0f7d81be7f18df15d Mon Sep 17 00:00:00 2001 From: Parth Buch Date: Tue, 17 Jul 2012 14:21:30 +0530 Subject: Fixed the nasty thumbnail url bug --- stapp/video/models.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'stapp') diff --git a/stapp/video/models.py b/stapp/video/models.py index 20af47c..1eb81f4 100644 --- a/stapp/video/models.py +++ b/stapp/video/models.py @@ -10,9 +10,8 @@ import Image, os def handle_thumb(image_obj, thumb_obj, width, height): # create thumbnail - if image_obj and not thumb_obj: - thumb = image_obj.path + ('-small.jpg') - #try: + thumb = str(image_obj) + ('-small.jpg') + try: t = Image.open(image_obj.path) w, h = t.size @@ -26,9 +25,9 @@ def handle_thumb(image_obj, thumb_obj, width, height): t.save(settings.MEDIA_ROOT + thumb, 'JPEG') os.chmod(settings.MEDIA_ROOT + thumb, 0666) - thumb_obj = image_obj.path + ('-small.jpg') - #except: - # pass + thumb_obj = thumb + except: + pass return thumb_obj -- cgit