Commit fa242d1a authored by Yoann Ono Dit Biot's avatar Yoann Ono Dit Biot
Browse files

Add GIF support

parent 3af1aef4
from tedimg import app
from PIL import Image
from PIL import Image, ImageSequence
import os
import binascii
......@@ -43,7 +43,10 @@ def save_with_thumbnail(image, filename):
thumb_file = os.path.join(app.config["THUMB_STORAGE"], dest)
thumb_size = app.config["THUMB_SIZE"]
# Save the image and thumbnail, format=image.format)
if image.format == 'GIF':, format=image.format, save_all=True)
else:, format=image.format)
image.thumbnail((thumb_size, thumb_size)), format=image.format)
return dest
......@@ -19,8 +19,8 @@ def show(path):
@app.route('/upload', methods=['POST'])
def upload():
url = flask.request.form['url']
uploaded = flask.request.files['file']
url = flask.request.form.get('url')
uploaded = flask.request.files.get('file')
# Get an image object from the uploaded image or URL
if uploaded:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment