diff options
author | lxf <sng@luxagraf.net> | 2020-12-18 12:19:52 -0500 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2020-12-18 12:19:52 -0500 |
commit | 25099bf480cbe8b13852ad45152946819ac4a812 (patch) | |
tree | 26330290b9e250a434a3468c8d636258bcee4ea0 /app/books | |
parent | 5004e89aa72159b7a1dbd90badeedd4558d398bb (diff) |
added image resizing back to books
Diffstat (limited to 'app/books')
-rw-r--r-- | app/books/kindleparser.py | 8 | ||||
-rw-r--r-- | app/books/models.py | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/books/kindleparser.py b/app/books/kindleparser.py index c56499e..93edfac 100644 --- a/app/books/kindleparser.py +++ b/app/books/kindleparser.py @@ -108,3 +108,11 @@ class KindleClippingsParser(object): body_markdown=body_markdown ) """ + + + + + + + + diff --git a/app/books/models.py b/app/books/models.py index 2ef9716..c003b25 100644 --- a/app/books/models.py +++ b/app/books/models.py @@ -93,14 +93,14 @@ class Book(models.Model): super(Book, self).save() -#@receiver(post_save, sender=Book) +@receiver(post_save, sender=Book) def post_save_events(sender, update_fields, created, instance, **kwargs): if instance.image: base_path = "%s/%s/" % (settings.MEDIA_ROOT, "/".join(str(i) for i in instance.image.name.split('/')[:-1])) filename, file_extension = os.path.splitext(instance.image.path) img = Image.open(instance.image.path) - resize_image(img, None, 160, 78, base_path, "%s_tn%s" % (filename.split('/')[-1], file_extension)) - resize_image(img, None, 650, 78, base_path, "%s_small%s" % (filename.split('/')[-1], file_extension)) + resize_image(img, None, 160, 78, "%s%s_tn%s" % (base_path, filename.split('/')[-1], file_extension)) + resize_image(img, None, 650, 78, "%s%s_small%s" % (base_path, filename.split('/')[-1], file_extension)) class BookHighlight(models.Model): |