A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Cleaned up the thumbnails by switching to .png
Daniel Quinn8a9ea4664c01
diff --git a/src/documents/migrations/0012_auto_20160305_0040.py b/src/documents/migrations/0012_auto_20160305_0040.pyindex e42c6cde5..876c2c68e 100644--- a/src/documents/migrations/0012_auto_20160305_0040.py+++ b/src/documents/migrations/0012_auto_20160305_0040.py@@ -65,17 +65,18 @@ def move_documents_and_create_thumbnails(apps, schema_editor):subprocess.Popen((settings.CONVERT_BINARY,- "-scale", "500x500",+ "-scale", "500x5000",+ "-alpha", "remove",orig_target,- os.path.join(thumb_temp, "convert-%04d.jpg")+ os.path.join(thumb_temp, "convert-%04d.png"))).wait()- thumb_source = os.path.join(thumb_temp, "convert-0000.jpg")+ thumb_source = os.path.join(thumb_temp, "convert-0000.png")thumb_target = os.path.join(settings.MEDIA_ROOT,"documents","thumbnails",- re.sub(r"(\d+)\.\w+(\.gpg)", "\\1.jpg\\2", f)+ re.sub(r"(\d+)\.\w+(\.gpg)", "\\1.png\\2", f))with open(thumb_source, "rb") as unencrypted:with open(thumb_target, "wb") as encrypted:diff --git a/src/documents/models.py b/src/documents/models.pyindex a3ffb8a74..b8baea7f8 100644--- a/src/documents/models.py+++ b/src/documents/models.py@@ -193,7 +193,7 @@ class Document(models.Model):settings.MEDIA_ROOT,"documents","thumbnails",- "{:07}.jpg.gpg".format(self.pk)+ "{:07}.png.gpg".format(self.pk))@propertydiff --git a/src/documents/views.py b/src/documents/views.pyindex 4a4a060bf..1dc23aa4f 100644--- a/src/documents/views.py+++ b/src/documents/views.py@@ -29,7 +29,7 @@ class IndexView(TemplateView):return TemplateView.get_context_data(self, **kwargs)-class FetchView(LoginRequiredMixin, DetailView):+class FetchView(DetailView):model = Document@@ -48,8 +48,8 @@ class FetchView(LoginRequiredMixin, DetailView):if self.kwargs["kind"] == "thumb":return HttpResponse(- GnuPG.decrypted(self.object.thumb_file),- content_type=content_types[Document.TYPE_JPG]+ GnuPG.decrypted(self.object.thumbnail_file),+ content_type=content_types[Document.TYPE_PNG])response = HttpResponse(