diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-08-26 05:18:10 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-08-26 05:18:10 +0000 |
commit | 98370267588204f878ba596c6c3bdf3ffc9c4d0c (patch) | |
tree | 8ffdecd1c4e5e257813374bf78c7ea6ac85aed84 /sca-cpp/trunk/hosting/server/imapd.py | |
parent | 2e5abd585874b18d5e94067ca7704a1966df3226 (diff) |
Improvements to the hosting management app server side logic.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1517420 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/hosting/server/imapd.py')
-rw-r--r-- | sca-cpp/trunk/hosting/server/imapd.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sca-cpp/trunk/hosting/server/imapd.py b/sca-cpp/trunk/hosting/server/imapd.py index a60e4e11c6..7a7bbda61f 100644 --- a/sca-cpp/trunk/hosting/server/imapd.py +++ b/sca-cpp/trunk/hosting/server/imapd.py @@ -20,12 +20,11 @@ from imaplib2 import IMAP4_SSL from threading import Thread, Event from email import message_from_string import re -from StringIO import StringIO -from PIL import Image from base64 import b64encode, b64decode from httplib import HTTPConnection, HTTPSConnection from urlparse import urlparse from util import * +from imgutil import * from sys import stderr, argv, exit from traceback import print_exc @@ -64,12 +63,8 @@ def fetchmail(id, imap): if len(parts) == 0: return (None, 'Email doesn\'t contain an image') - # Convert image to a 50x50 PNG image - img = Image.open(StringIO(parts[0])) - t = img.resize((50, 50)) - obuf = StringIO() - t.save(obuf, 'PNG') - dataurl = 'data:image/png;base64,' + b64encode(obuf.getvalue()).replace('\n', '') + # Convert image to a 50x50 JPEG image + dataurl = bufto50x50jpeg(parts[0]) # Return address, image url pair return (address, dataurl) |