diff --git a/dashboard/src/components/ImagePicker.vue b/dashboard/src/components/ImagePicker.vue index 9120fbad9..01b3ba216 100644 --- a/dashboard/src/components/ImagePicker.vue +++ b/dashboard/src/components/ImagePicker.vue @@ -51,7 +51,7 @@ function onChanged(event) { fr.onload = function () { const image = new Image(); image.onload = function () { - const size = props.size ? parseInt(props.size) : 0; + const size = props.size ? parseInt(props.size) : 512; const maxSize = props.maxSize ? parseInt(props.maxSize) : 0; const canvas = document.createElement('canvas'); diff --git a/dashboard/src/views/ProfileView.vue b/dashboard/src/views/ProfileView.vue index 3df4a13d7..3d9ffbfb1 100644 --- a/dashboard/src/views/ProfileView.vue +++ b/dashboard/src/views/ProfileView.vue @@ -11,6 +11,7 @@ import AppPasswords from '../components/AppPasswords.vue'; import SettingsItem from '../components/SettingsItem.vue'; import Section from '../components/Section.vue'; import ApiTokens from '../components/ApiTokens.vue'; +import ImagePicker from '../components/ImagePicker.vue'; import DashboardModel from '../models/DashboardModel.js'; import ProfileModel from '../models/ProfileModel.js'; @@ -106,11 +107,10 @@ async function onChangeFallbackEmail(currentFallbackEmail) { await refreshProfile(); } -const avatarFileInput = useTemplateRef('avatarFileInput'); -async function onAvatarChanged() { - if (!avatarFileInput.value.files[0]) return; - await profileModel.setAvatar(avatarFileInput.value.files[0]); +async function onAvatarChanged(file) { + await profileModel.setAvatar(file); + // TODO we somehow need to do this globally // invalidate and refresh profile avatar url const u = new URL(user.value.avatarUrl); u.searchParams.set('ts', Date.now()); @@ -268,10 +268,7 @@ onMounted(async () => {