fix avatar images to respect remote/local hosting config
This commit is contained in:
parent
586dd84a01
commit
c57f84b1b4
1 changed files with 4 additions and 3 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
import Button from './ui/Button.svelte'
|
import Button from './ui/Button.svelte'
|
||||||
import Input from './ui/Input.svelte'
|
import Input from './ui/Input.svelte'
|
||||||
import { pictureData, type Picture } from '$lib/utils/pictureData'
|
import { pictureData, type Picture } from '$lib/utils/pictureData'
|
||||||
|
import { getAvatarSrc, getAvatarSrcSet } from '$lib/utils/avatar'
|
||||||
import { users } from '$lib/api/resources/users'
|
import { users } from '$lib/api/resources/users'
|
||||||
import type { UserCookie } from '$lib/types/UserCookie'
|
import type { UserCookie } from '$lib/types/UserCookie'
|
||||||
import { setUserCookie } from '$lib/auth/cookies'
|
import { setUserCookie } from '$lib/auth/cookies'
|
||||||
|
|
@ -89,7 +90,7 @@
|
||||||
.map((p) => ({
|
.map((p) => ({
|
||||||
value: p.filename,
|
value: p.filename,
|
||||||
label: p.name[locale] || p.name.en,
|
label: p.name[locale] || p.name.en,
|
||||||
image: `/profile/${p.filename}.png`
|
image: getAvatarSrc(p.filename)
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -224,8 +225,8 @@
|
||||||
<div class="picture-section">
|
<div class="picture-section">
|
||||||
<div class="current-avatar">
|
<div class="current-avatar">
|
||||||
<img
|
<img
|
||||||
src={`/profile/${picture}.png`}
|
src={getAvatarSrc(picture)}
|
||||||
srcset={`/profile/${picture}.png 1x, /profile/${picture}@2x.png 2x`}
|
srcset={getAvatarSrcSet(picture)}
|
||||||
alt={currentPicture?.name[locale] || ''}
|
alt={currentPicture?.name[locale] || ''}
|
||||||
class="avatar-preview element-{element}"
|
class="avatar-preview element-{element}"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue