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/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",
|
||||||
|
|||||||
@@ -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
@@ -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;
|
||||||
|
|||||||
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