add "broken_image.png" as fallback

This commit is contained in:
or-else
2019-01-13 14:46:46 +03:00
parent fcb3d78cc4
commit e028503c9e
7 changed files with 12 additions and 5 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

+1
View File
@@ -46,6 +46,7 @@
"img/logo96.png", "img/logo96.png",
"img/logo192.png", "img/logo192.png",
"img/badge96.png", "img/badge96.png",
"img/broken_image.png",
"index-dev.html", "index-dev.html",
"index.html", "index.html",
"manifest.json", "manifest.json",
+3 -1
View File
@@ -18,7 +18,9 @@ export default class LetterTile extends React.PureComponent {
<i className="material-icons">person</i>; <i className="material-icons">person</i>;
} }
} else if (this.props.avatar) { } else if (this.props.avatar) {
avatar = <img className="avatar" alt="avatar" src={this.props.avatar} />; // If avatar image is invalid, show a placeholder.
avatar = <img className="avatar" alt="avatar" src={this.props.avatar}
onError={(e)=>{e.target.onerror = null; e.target.src="/img/broken_image.png"}} />;
} else { } else {
avatar = null; avatar = null;
} }
+5 -1
View File
@@ -8077,7 +8077,11 @@ var LetterTile = function (_React$PureComponent) {
avatar = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("img", { avatar = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("img", {
className: "avatar", className: "avatar",
alt: "avatar", alt: "avatar",
src: this.props.avatar src: this.props.avatar,
onError: function onError(e) {
e.target.onerror = null;
e.target.src = "/img/broken_image.png";
}
}); });
} else { } else {
avatar = null; avatar = null;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long