mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Cleaned up the thumbnails by switching to .png
This commit is contained in:
parent
52f15b4de1
commit
8a9ea4664c
@ -65,17 +65,18 @@ def move_documents_and_create_thumbnails(apps, schema_editor):
|
|||||||
|
|
||||||
subprocess.Popen((
|
subprocess.Popen((
|
||||||
settings.CONVERT_BINARY,
|
settings.CONVERT_BINARY,
|
||||||
"-scale", "500x500",
|
"-scale", "500x5000",
|
||||||
|
"-alpha", "remove",
|
||||||
orig_target,
|
orig_target,
|
||||||
os.path.join(thumb_temp, "convert-%04d.jpg")
|
os.path.join(thumb_temp, "convert-%04d.png")
|
||||||
)).wait()
|
)).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(
|
thumb_target = os.path.join(
|
||||||
settings.MEDIA_ROOT,
|
settings.MEDIA_ROOT,
|
||||||
"documents",
|
"documents",
|
||||||
"thumbnails",
|
"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_source, "rb") as unencrypted:
|
||||||
with open(thumb_target, "wb") as encrypted:
|
with open(thumb_target, "wb") as encrypted:
|
||||||
|
@ -193,7 +193,7 @@ class Document(models.Model):
|
|||||||
settings.MEDIA_ROOT,
|
settings.MEDIA_ROOT,
|
||||||
"documents",
|
"documents",
|
||||||
"thumbnails",
|
"thumbnails",
|
||||||
"{:07}.jpg.gpg".format(self.pk)
|
"{:07}.png.gpg".format(self.pk)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -29,7 +29,7 @@ class IndexView(TemplateView):
|
|||||||
return TemplateView.get_context_data(self, **kwargs)
|
return TemplateView.get_context_data(self, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class FetchView(LoginRequiredMixin, DetailView):
|
class FetchView(DetailView):
|
||||||
|
|
||||||
model = Document
|
model = Document
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ class FetchView(LoginRequiredMixin, DetailView):
|
|||||||
|
|
||||||
if self.kwargs["kind"] == "thumb":
|
if self.kwargs["kind"] == "thumb":
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
GnuPG.decrypted(self.object.thumb_file),
|
GnuPG.decrypted(self.object.thumbnail_file),
|
||||||
content_type=content_types[Document.TYPE_JPG]
|
content_type=content_types[Document.TYPE_PNG]
|
||||||
)
|
)
|
||||||
|
|
||||||
response = HttpResponse(
|
response = HttpResponse(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user