summaryrefslogtreecommitdiffstats
path: root/webapp/components/file_attachment.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/file_attachment.jsx')
-rw-r--r--webapp/components/file_attachment.jsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/webapp/components/file_attachment.jsx b/webapp/components/file_attachment.jsx
index 3d7f936c8..5642d33c5 100644
--- a/webapp/components/file_attachment.jsx
+++ b/webapp/components/file_attachment.jsx
@@ -48,14 +48,16 @@ export default class FileAttachment extends React.Component {
if (fileType === 'image') {
const thumbnailUrl = getFileThumbnailUrl(fileInfo.id);
- const img = new Image();
- img.onload = () => {
- this.setState({loaded: true});
- };
- img.load(thumbnailUrl);
+ Utils.loadImage(thumbnailUrl, this.handleImageLoaded);
}
}
+ handleImageLoaded = () => {
+ this.setState({
+ loaded: true
+ });
+ }
+
onAttachmentClick(e) {
e.preventDefault();
this.props.handleImageClick(this.props.index);