Skip to content

Commit

Permalink
Merge pull request #3492 from mikiher/author-image-ar
Browse files Browse the repository at this point in the history
Use object-cover for author images unless AR is really high or low
  • Loading branch information
advplyr authored Oct 9, 2024
2 parents f38b663 + cfae607 commit a6da324
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions client/components/covers/AuthorImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,10 @@ export default {
},
methods: {
imageLoaded() {
var aspectRatio = 1.25
if (this.$refs.wrapper) {
aspectRatio = this.$refs.wrapper.clientHeight / this.$refs.wrapper.clientWidth
}
if (this.$refs.img) {
var { naturalWidth, naturalHeight } = this.$refs.img
var imgAr = naturalHeight / naturalWidth
var arDiff = Math.abs(imgAr - aspectRatio)
if (arDiff > 0.15) {
if (imgAr < 0.5 || imgAr > 2) {
this.showCoverBg = true
} else {
this.showCoverBg = false
Expand Down

0 comments on commit a6da324

Please sign in to comment.