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 41ef70a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/api/helpers/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import urllib.parse
import urllib.request
import uuid
import requests

import PIL
from PIL import Image
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 41ef70a

Please sign in to comment.