use img instead of background-image since img works with large files but bg-image does not

This commit is contained in:
Henry Jameson 2025-08-07 17:09:58 +03:00
commit 409816748e
3 changed files with 28 additions and 17 deletions

View file

@ -186,14 +186,6 @@ export default {
relationship () { relationship () {
return this.$store.getters.relationship(this.userId) return this.$store.getters.relationship(this.userId)
}, },
style () {
return {
backgroundImage: [
'linear-gradient(to bottom, var(--profileTint), var(--profileTint))',
`url(${this.bannerImgSrc})`
].join(', ')
}
},
isOtherUser () { isOtherUser () {
return this.user.id !== this.$store.state.users.currentUser.id return this.user.id !== this.$store.state.users.currentUser.id
}, },
@ -419,11 +411,11 @@ export default {
}, },
resetImage () { resetImage () {
if (this.editImage === 'avatar') { if (this.editImage === 'avatar') {
this.newAvatar = '' this.newAvatar = null
this.newAvatarFile = '' this.newAvatarFile = null
} else { } else {
this.newBanner = '' this.newBanner = null
this.newBannerFile = '' this.newBannerFile = null
} }
this.editImage = false this.editImage = false
}, },

View file

@ -111,7 +111,8 @@
} }
} }
.background-image { .banner-overlay,
.banner-image {
position: absolute; position: absolute;
inset: 0; inset: 0;
right: -1.2em; right: -1.2em;
@ -119,11 +120,24 @@
top: -1.4em; top: -1.4em;
padding: 0; padding: 0;
mask: linear-gradient(to top, transparent 0, white 5em) bottom no-repeat; mask: linear-gradient(to top, transparent 0, white 5em) bottom no-repeat;
background-size: cover;
background-color: var(--profileBg);
border-top-left-radius: calc(var(--roundness) - 1px); border-top-left-radius: calc(var(--roundness) - 1px);
border-top-right-radius: calc(var(--roundness) - 1px); border-top-right-radius: calc(var(--roundness) - 1px);
}
.banner-image {
z-index: -2; z-index: -2;
img {
object-fit: cover;
height: 100%;
width: 100%;
}
}
.banner-overlay {
background-color: var(--profileTint);
pointer-events: none; // let user copy bg url
z-index: -1;
} }
.bottom-buttons { .bottom-buttons {

View file

@ -3,10 +3,15 @@
<div class="user-card-inner"> <div class="user-card-inner">
<div class="user-info"> <div class="user-info">
<div class="user-identity"> <div class="user-identity">
<div <div class="banner-image">
<img
:src="bannerImgSrc"
:class="{ 'hide-bio': hideBio }"
>
</div>
<div
class="banner-overlay"
:class="{ 'hide-bio': hideBio }" :class="{ 'hide-bio': hideBio }"
:style="style"
class="background-image"
/> />
<a <a
v-if="avatarAction === 'zoom'" v-if="avatarAction === 'zoom'"