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]
|
* 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)
|
0.7.0 (2013-11-13)
|
||||||
------------------
|
------------------
|
||||||
|
10
converse.js
10
converse.js
@ -1207,9 +1207,13 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var img_src = 'data:'+this.model.get('image_type')+';base64,'+this.model.get('image'),
|
var img_src = 'data:'+this.model.get('image_type')+';base64,'+this.model.get('image'),
|
||||||
canvas = $('<canvas height="33px" width="33px" class="avatar"></canvas>'),
|
canvas = $('<canvas height="33px" width="33px" class="avatar"></canvas>').get(0);
|
||||||
ctx = canvas.get(0).getContext('2d'),
|
|
||||||
img = new Image(); // Create new Image object
|
if (!(canvas.getContext && canvas.getContext('2d'))) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
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);
|
ctx.drawImage(img, 0,0, 35*ratio, 35);
|
||||||
|
Loading…
Reference in New Issue
Block a user