Skip to content

Commit

Permalink
fix: Image resizing performed using requests library
Browse files Browse the repository at this point in the history
  • Loading branch information
codedsun committed Dec 5, 2019
1 parent 6d098cb commit aab9453
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/api/helpers/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import urllib.parse
import urllib.request
import uuid
import requests

import PIL
from PIL import Image
from PIL import Image, ImageFile
from flask import current_app
from flask import current_app as app
from sqlalchemy.orm.exc import NoResultFound
Expand Down Expand Up @@ -77,7 +78,7 @@ def create_save_resized_image(image_file, basewidth=None, maintain_aspect=None,
if not image_file:
return None
filename = '{filename}.{ext}'.format(filename=get_file_name(), ext=ext)
data = urllib.request.urlopen(image_file).read()
data = requests.get(image_file, stream=True).content
image_file = io.BytesIO(data)
try:
im = Image.open(image_file)
Expand Down

0 comments on commit aab9453

Please sign in to comment.