|
|
|
@ -384,10 +384,10 @@ function getAvatar(username, img) {
@@ -384,10 +384,10 @@ function getAvatar(username, img) {
|
|
|
|
|
if (data) { |
|
|
|
|
switch (data.substr(0, 4)) { |
|
|
|
|
case 'jpg/': |
|
|
|
|
data = 'data:image/jpeg;base64,/9j/' + data.slice(4); |
|
|
|
|
data = 'data:image/jpeg;base64,/9j/' + window.btoa(data.slice(4)); |
|
|
|
|
break; |
|
|
|
|
case 'png/': |
|
|
|
|
data = 'data:image/png;base64,' + data.slice(4); |
|
|
|
|
data = 'data:image/png;base64,' + window.btoa(data.slice(4)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
_avatarMap[username] = data; |
|
|
|
@ -399,9 +399,9 @@ function getAvatar(username, img) {
@@ -399,9 +399,9 @@ function getAvatar(username, img) {
|
|
|
|
|
_avatarMap[req.username] = imagedata; |
|
|
|
|
if (imagedata !== 'img/genericPerson.png') { |
|
|
|
|
if (imagedata.substr(0, 27) === 'data:image/jpeg;base64,/9j/') |
|
|
|
|
_putResourceIntoStorage('avatar:' + username, 'jpg/' + imagedata.slice(27)); |
|
|
|
|
_putResourceIntoStorage('avatar:' + username, 'jpg/' + window.atob(imagedata.slice(27))); |
|
|
|
|
else if (imagedata.substr(0, 22) === 'data:image/png;base64,') |
|
|
|
|
_putResourceIntoStorage('avatar:' + username, 'png/' + imagedata.slice(22)); |
|
|
|
|
_putResourceIntoStorage('avatar:' + username, 'png/' + window.atob(imagedata.slice(22))); |
|
|
|
|
else |
|
|
|
|
_putResourceIntoStorage('avatar:' + username, imagedata); |
|
|
|
|
} |
|
|
|
|