Check if canvas is supported before trying to render the user avatar.
This commit is contained in:
parent
490d96fd26
commit
4a1eac06cb
@ -5,6 +5,7 @@ Changelog
|
||||
------------------
|
||||
|
||||
* Don't load OTR crypto if the browser doesn't have a CSRNG [jcbrand]
|
||||
* Check if canvas is supported before trying to render the user avatar [jcbrand]
|
||||
|
||||
0.7.0 (2013-11-13)
|
||||
------------------
|
||||
|
10
converse.js
10
converse.js
@ -1207,9 +1207,13 @@
|
||||
return;
|
||||
}
|
||||
var img_src = 'data:'+this.model.get('image_type')+';base64,'+this.model.get('image'),
|
||||
canvas = $('<canvas height="33px" width="33px" class="avatar"></canvas>'),
|
||||
ctx = canvas.get(0).getContext('2d'),
|
||||
img = new Image(); // Create new Image object
|
||||
canvas = $('<canvas height="33px" width="33px" class="avatar"></canvas>').get(0);
|
||||
|
||||
if (!(canvas.getContext && canvas.getContext('2d'))) {
|
||||
return this;
|
||||
}
|
||||
var ctx = canvas.getContext('2d');
|
||||
var img = new Image(); // Create new Image object
|
||||
img.onload = function() {
|
||||
var ratio = img.width/img.height;
|
||||
ctx.drawImage(img, 0,0, 35*ratio, 35);
|
||||
|
Loading…
Reference in New Issue
Block a user