From bfc72d6ee287ae6afaed266f48f6522b861c0a68 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Benoi=CC=82t=20Pin?= <benoit.pin@gmail.com>
Date: Thu, 10 Apr 2014 05:08:26 +0200
Subject: [PATCH] =?utf8?q?Impl=C3=A9mentation=20envoi=20d'images.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 AttachmentTool.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/AttachmentTool.py b/AttachmentTool.py
index 58c3e07..979148d 100644
--- a/AttachmentTool.py
+++ b/AttachmentTool.py
@@ -185,7 +185,16 @@ class AttachmentContainer (Folder):
         ob.PUT(REQUEST, RESPONSE)
         RESPONSE.setStatus(httpRespCode)
         RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
-        return '<element id="%s" title="%s"/>' % (ob.getId(), escape(ob.title_or_id()))
+        if ob.meta_type == 'File' :
+            return '<element id="%s" title="%s"/>' % (ob.getId(), escape(ob.title_or_id()))
+        elif ob.meta_type == 'Photo' :
+            width, height = ob.getResizedImageSize(size=(310, 310))
+            return '<element src="%(src)s" title="%(title)s" width="%(width)d" height="%(height)d"/>' % \
+                {'src' : 'attachments/%s/getResizedImage?size=%d_%d' % (ob.getId(), width, height),
+                 'title' : escape(ob.title_or_id()),
+                 'width' : width,
+                 'height' : height
+                 }
 
 
 InitializeClass(AttachmentContainer)
\ No newline at end of file
-- 
2.20.1