stop using exiv2
parent
46225890ef
commit
6df9ac1b53
|
@ -10,7 +10,6 @@ RUN apt install -y ffmpeg
|
||||||
RUN apt install -y postgresql
|
RUN apt install -y postgresql
|
||||||
RUN apt install -y libpq-dev
|
RUN apt install -y libpq-dev
|
||||||
RUN apt install -y nano
|
RUN apt install -y nano
|
||||||
RUN apt install -y exiv2
|
|
||||||
|
|
||||||
COPY requirements.txt /etc/requirements.txt
|
COPY requirements.txt /etc/requirements.txt
|
||||||
|
|
||||||
|
|
|
@ -140,8 +140,7 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with Image.open(filename) as i:
|
with Image.open(filename) as i:
|
||||||
params = ["magick", filename]
|
params = ["magick", filename, filename, "-coalesce", "-strip", "-auto-orient", "-quality", "88"]
|
||||||
params.extend(["-coalesce", "-quality", "88"])
|
|
||||||
if trim and len(list(Iterator(i))) == 1:
|
if trim and len(list(Iterator(i))) == 1:
|
||||||
params.append("-trim")
|
params.append("-trim")
|
||||||
if resize and i.width > resize:
|
if resize and i.width > resize:
|
||||||
|
@ -155,17 +154,13 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
|
||||||
abort(415)
|
abort(415)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(params) > 2:
|
try:
|
||||||
params.extend(["-strip", "-auto-orient", filename])
|
subprocess.run(params, timeout=MAX_IMAGE_CONVERSION_TIMEOUT)
|
||||||
try:
|
except subprocess.TimeoutExpired:
|
||||||
subprocess.run(params, timeout=MAX_IMAGE_CONVERSION_TIMEOUT)
|
if has_request:
|
||||||
except subprocess.TimeoutExpired:
|
abort(413, ("An uploaded image took too long to convert to WEBP. "
|
||||||
if has_request:
|
"Please convert it to WEBP elsewhere then upload it again."))
|
||||||
abort(413, ("An uploaded image took too long to convert to WEBP. "
|
return None
|
||||||
"Please convert it to WEBP elsewhere then upload it again."))
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
subprocess.run(["exiv2", "rm", filename], timeout=MAX_IMAGE_CONVERSION_TIMEOUT)
|
|
||||||
|
|
||||||
if resize:
|
if resize:
|
||||||
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_MB * 1024 * 1024:
|
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_MB * 1024 * 1024:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
apt -y update
|
apt -y update
|
||||||
apt -y upgrade
|
apt -y upgrade
|
||||||
apt -y install git redis-server python3-pip ffmpeg tmux nginx snapd ufw gpg-agent htop nano exiv2
|
apt -y install git redis-server python3-pip ffmpeg tmux nginx snapd ufw gpg-agent htop nano
|
||||||
|
|
||||||
git config --global credential.helper store
|
git config --global credential.helper store
|
||||||
cd /rDrama
|
cd /rDrama
|
||||||
|
|
Loading…
Reference in New Issue