Hey there, I've got the below code.
Can someone help me fill in the gaps to rename the image to the
'SLUG'?

In the end I'm hoping for images like so:

 ...com/books/book-title.jpg
 ...com/books/thumbs/book-title.jpg

Here's my save() definition from models.py:

def save(self):
        super(Book, self).save()

        image_path = '%s%s' % (settings.MEDIA_ROOT, str(self.cover))
        path, filename = os.path.split(image_path)

        thumb_name = '%s/thumbs/%s' % (path, filename)

        gen_thumb(image_path, thumb_name, size=160)
        self.thumb = '%s' % filename

        super(Book, self).save()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to