Commit c6477832 authored by JC Brand's avatar JC Brand

Make avatar round and center/resize image properly.

parent 4619d886
...@@ -2074,7 +2074,12 @@ ...@@ -2074,7 +2074,12 @@
var img = new Image(); // Create new Image object var img = new Image(); // Create new Image object
img.onload = function () { img.onload = function () {
var ratio = img.width/img.height; var ratio = img.width/img.height;
ctx.drawImage(img, 0,0, 35*ratio, 35); if (ratio < 1) {
ctx.drawImage(img, 0,0, 32, 32*(1/ratio));
} else {
ctx.drawImage(img, 0,0, 32, 32*ratio);
}
}; };
img.src = img_src; img.src = img_src;
this.$el.find('.chat-title').before(canvas); this.$el.find('.chat-title').before(canvas);
......
...@@ -1241,6 +1241,7 @@ ...@@ -1241,6 +1241,7 @@
padding: 5px; padding: 5px;
position: relative; } position: relative; }
#conversejs .chat-head .avatar { #conversejs .chat-head .avatar {
border-radius: 50%;
float: left; } float: left; }
#conversejs .chat-head.chat-head-chatbox { #conversejs .chat-head.chat-head-chatbox {
background-color: #F4A261; } background-color: #F4A261; }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
padding: 5px; padding: 5px;
position: relative; position: relative;
.avatar { .avatar {
border-radius: 50%;
float: left; float: left;
} }
&.chat-head-chatbox { &.chat-head-chatbox {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment