Merge pull request #3492 from mikiher/author-image-ar

Use object-cover for author images unless AR is really high or low
This commit is contained in:
advplyr 2024-10-09 17:31:24 -05:00 committed by GitHub
commit a6da32430f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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