Entirely removes the optipng, updates ghostscript fall back to also use WebP. Updates the conversion to use a multiprocessing pool

This commit is contained in:
Trenton Holmes
2022-06-11 08:38:49 -07:00
parent 7d9a9033f9
commit e8868d7ebf
17 changed files with 65 additions and 162 deletions

View File

@@ -308,17 +308,11 @@ class Document(models.Model):
png_file_path = os.path.join(settings.THUMBNAIL_DIR, png_file_name)
# 1. Assume the thumbnail is WebP
if not os.path.exists(webp_file_path):
# 2. If WebP doesn't exist, check PNG
if not os.path.exists(png_file_path):
# 3. If PNG doesn't exist, filename is being constructed, return WebP
thumb = webp_file_path
else:
# 2.1 - PNG file exists, return path to it
thumb = png_file_path
if os.path.exists(png_file_path):
thumb = png_file_path
else:
# 1.1 - WebP file exists, return path to it
thumb = webp_file_path
return os.path.normpath(thumb)
@property