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 50a263e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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).content
image_file = io.BytesIO(data)
try:
im = Image.open(image_file)
Expand Down
4 changes: 2 additions & 2 deletions docs/api/blueprint/user/users.apib
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Create a new user using an email, password and an optional name.
{
"email": "[email protected]",
"password": "password",
"avatar_url": "http://example.com/example.png",
"avatar_url": "https://cdn.pixabay.com/photo/2015/03/04/22/35/head-659651_960_720.png",
"first-name": "John",
"last-name": "Doe",
"details": "example",
Expand Down Expand Up @@ -550,7 +550,7 @@ Authorized user should be same as user in request body or must be admin.
"data": {
"attributes": {
"password": "password",
"avatar_url": "http://example.com/example.png",
"avatar_url": "https://cdn.pixabay.com/photo/2015/03/04/22/35/head-659651_960_720.png",
"first-name": "John",
"last-name": "Doe",
"details": "example1",
Expand Down

0 comments on commit 50a263e

Please sign in to comment.