mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Cleaned up the thumbnails by switching to .png
This commit is contained in:
		@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
 
 | 
			
		||||
@@ -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(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user