From: Benoît Pin Date: Thu, 10 Apr 2014 03:08:26 +0000 (+0200) Subject: Implémentation envoi d'images. X-Git-Url: https://scm.cri.mines-paristech.fr/git/Plinn.git/commitdiff_plain/bfc72d6ee287ae6afaed266f48f6522b861c0a68?ds=sidebyside;hp=047a8a28622908692f43ecb4b267ba8338ea9205 Implémentation envoi d'images. --- 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 '' % (ob.getId(), escape(ob.title_or_id())) + if ob.meta_type == 'File' : + return '' % (ob.getId(), escape(ob.title_or_id())) + elif ob.meta_type == 'Photo' : + width, height = ob.getResizedImageSize(size=(310, 310)) + return '' % \ + {'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