Commit bece22ee authored by JC Brand's avatar JC Brand

Check if canvas is supported before trying to render the user avatar.

Conflicts:
	CHANGES.rst
parent c13fcb74
......@@ -5,6 +5,7 @@ Changelog
------------------
* Bugfix: If fullname doesn't exist, an exception *split method doesn't exist* is raised [chenhouwu]
* Check if canvas is supported before trying to render the user avatar [jcbrand]
0.6.6 (2013-10-16)
------------------
......
......@@ -739,9 +739,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);
......
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