plugin XEP-0054: fixed bad image resizing

This commit is contained in:
Goffi 2013-01-07 23:08:45 +01:00
commit 44a042df6d

View file

@ -232,14 +232,14 @@ class XEP_0054():
return ""
return filename
def _buildSetAvatar(self, vcard_set, filepath):
def _buildSetAvatar(self, vcard_set, filepath):
try:
img = Image.open(filepath)
except IOError:
raise exceptions.DataError("Can't open image")
if img.size != (64, 64):
img.resize((64, 64))
img = img.resize((64, 64))
img_buf = StringIO()
img.save(img_buf, 'PNG')