diff --git a/group/templates/group/group_discuss.html b/group/templates/group/group_discuss.html
index 1666dc7470..d85cad26bd 100644
--- a/group/templates/group/group_discuss.html
+++ b/group/templates/group/group_discuss.html
@@ -83,8 +83,16 @@
{% if ma.src == 'recommend' %}
{% if ma.attach_type == 'file' %}
-

-
{{ ma.name }}
+ {% if ma.filetype != 'Image'%}
+

+
{{ ma.name }}
+ {% else %}
+ {% if ma.err %}
+
{{ma.err}}
+ {% else %}
+

+ {% endif %}
+ {% endif %}
{% else %}
{{ ma.name }}
diff --git a/group/views.py b/group/views.py
index ee478849d6..0d737c8998 100644
--- a/group/views.py
+++ b/group/views.py
@@ -1051,6 +1051,16 @@ def group_discuss(request, group):
if path[-1] == '/':
path = path[:-1]
att.name = os.path.basename(path)
+ if att.attach_type == 'file' and att.src == 'recommend':
+ att.filetype, att.fileext = get_file_type_and_ext(att.name)
+ if att.filetype == 'Image':
+ att.obj_id = get_file_id_by_path(att.repo_id, path)
+ if not att.obj_id:
+ att.err = _(u'File does not exist')
+ else:
+ att.token = web_get_access_token(att.repo_id, att.obj_id, 'view', request.user.username)
+ att.img_url = gen_file_get_url(att.token, att.name)
+
msg.attachment = att
return render_to_response("group/group_discuss.html", {
diff --git a/media/css/seahub.css b/media/css/seahub.css
index a16da29efc..15a3768145 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -152,6 +152,7 @@ p {
.vh { visibility:hidden; }
.vam { vertical-align:middle; }
.italic { font-style:italic; }
+.al-rt { text-align:right; }
.notification {
padding:5px;
background:#FDF;
@@ -161,9 +162,6 @@ p {
color:#808080;
font-size:12px;
}
-.al-rt {
- text-align:right;
-}
.op,
.more {
font-weight:normal;
@@ -1520,6 +1518,18 @@ textarea:-moz-placeholder {/* for FF */
border-top:1px solid #e9e9e9;
margin-top:12px;
}
+.msg-attachment .img-cont {
+ display:block;
+ text-align:center;
+ line-height:0;
+ background:#fcfcfc;
+}
+.msg-attachment .img {
+ width:auto;
+ height:auto;
+ max-width:100%;
+ max-height:300px;
+}
.msg-hd .author {
font-weight:bold;
}