From ab8055b5cab2523d925f59c65bc38df103a26991 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 2 Dec 2020 15:02:12 -0500 Subject: deleted old apps and media --- app/photos/utils.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 app/photos/utils.py (limited to 'app/photos/utils.py') diff --git a/app/photos/utils.py b/app/photos/utils.py deleted file mode 100644 index 84e72f5..0000000 --- a/app/photos/utils.py +++ /dev/null @@ -1,28 +0,0 @@ -import os -import re -import subprocess - -from django.apps import apps -from django.conf import settings - -from PIL import ImageFile -from bs4 import BeautifulSoup -# pip install python-resize-image -from resizeimage import resizeimage - - -def resize_image(img, width=None, height=None, quality=72, base_path="", filename=""): - if width and height: - newimg = resizeimage.resize_cover(img, [width, height]) - if width and not height: - newimg = resizeimage.resize_width(img, width) - if height and not width: - newimg = resizeimage.resize_height(img, height) - if not os.path.isdir(base_path): - os.makedirs(base_path) - path = "%s%s" % (base_path, filename) - ImageFile.MAXBLOCK = img.size[0] * img.size[1] * 4 - newimg.save(path, newimg.format, quality=quality) - subprocess.call(["jpegoptim", "%s" % path]) - - -- cgit v1.2.3