plugin XEP-0054: fixed bad image resizing
This commit is contained in:
parent
51a150d99a
commit
44a042df6d
1 changed files with 2 additions and 2 deletions
|
|
@ -232,14 +232,14 @@ class XEP_0054():
|
||||||
return ""
|
return ""
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def _buildSetAvatar(self, vcard_set, filepath):
|
def _buildSetAvatar(self, vcard_set, filepath):
|
||||||
try:
|
try:
|
||||||
img = Image.open(filepath)
|
img = Image.open(filepath)
|
||||||
except IOError:
|
except IOError:
|
||||||
raise exceptions.DataError("Can't open image")
|
raise exceptions.DataError("Can't open image")
|
||||||
|
|
||||||
if img.size != (64, 64):
|
if img.size != (64, 64):
|
||||||
img.resize((64, 64))
|
img = img.resize((64, 64))
|
||||||
img_buf = StringIO()
|
img_buf = StringIO()
|
||||||
img.save(img_buf, 'PNG')
|
img.save(img_buf, 'PNG')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue