Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
Some images may not have size passed
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Mar 18, 2019
1 parent c9e7a0b commit ec6e836
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/service/slack/slack-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ class SlackFile extends File {
this.image = imageStore.weyUrlFromImagePath(imagePath)
this.isImageCached = true
}
this.imageWidth = Math.min(f.original_w, 360)
this.imageHeight = f.original_h * this.imageWidth / f.original_w
if (f.original_w) {
this.imageWidth = Math.min(f.original_w, 360)
this.imageHeight = f.original_h * this.imageWidth / f.original_w
} else {
this.imageWidth = 360
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/view/chat/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{{/if}}
{{#if image}}
<div class="image">
<a href="{{imageUrl}}"><img width="{{imageWidth}}" height="{{imageHeight}}" src="{{image}}"/></a>
<a href="{{imageUrl}}"><img width="{{imageWidth}}"{{#if imageHeight}} height="{{imageHeight}}"{{/if}} src="{{image}}"/></a>
</div>
{{/if}}
</div>
Expand Down

0 comments on commit ec6e836

Please sign in to comment.