add "broken_image.png" as fallback
This commit is contained in:
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -46,6 +46,7 @@
|
||||
"img/logo96.png",
|
||||
"img/logo192.png",
|
||||
"img/badge96.png",
|
||||
"img/broken_image.png",
|
||||
"index-dev.html",
|
||||
"index.html",
|
||||
"manifest.json",
|
||||
|
||||
@@ -18,7 +18,9 @@ export default class LetterTile extends React.PureComponent {
|
||||
<i className="material-icons">person</i>;
|
||||
}
|
||||
} 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 {
|
||||
avatar = null;
|
||||
}
|
||||
|
||||
+5
-1
@@ -8077,7 +8077,11 @@ var LetterTile = function (_React$PureComponent) {
|
||||
avatar = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("img", {
|
||||
className: "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 {
|
||||
avatar = null;
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user