increased avatar upload size to 8mb

This commit is contained in:
unknown 2020-01-11 14:55:20 +00:00
parent 770d23de2d
commit 67502d7ea2
4 changed files with 5 additions and 59 deletions

View file

@ -122,11 +122,11 @@ export default {
} }
const file = event.target.files[0]; const file = event.target.files[0];
const _this = this; const _this = this;
const maxSize = 2092000; const maxSize = 8092000;
if (file.size > maxSize) { if (file.size > maxSize) {
return this.$store.dispatch( return this.$store.dispatch(
"setGenericMessage", "setGenericMessage",
"Image is larger than 2MB" "Image is larger than 8MB"
); );
} }
event.target.value = ""; event.target.value = "";

View file

@ -34,11 +34,6 @@
const Survey = () => import("./survey.vue"); const Survey = () => import("./survey.vue");
const EditProfile = () => import("./EditProfile.vue"); const EditProfile = () => import("./EditProfile.vue");
import AvatarUpload from "@/services/AvatarUpload.js";
import config from "@/config.js";
import path from "path";
import { mapState } from "vuex";
export default { export default {
components: { components: {
Survey, Survey,
@ -52,57 +47,6 @@ export default {
show: false show: false
} }
}; };
},
methods: {
onProgress(percent) {
//update vue
console.log("Avatar upload progress: ", percent);
},
async avatarBrowse(event) {
const file = event.target.files[0];
event.target.value = "";
const allowedFormats = [".png", ".jpeg", ".gif", ".jpg"];
if (!allowedFormats.includes(path.extname(file.name).toLowerCase())) {
this.alert.content = "Upload failed - Unsupported image file.";
return (this.alert.show = true);
} else if (file.size >= 2092000) {
// 2092000 = 2mb
this.alert.content =
"Upload failed - Image size must be less than 2 megabytes.";
return (this.alert.show = true);
}
const formData = new FormData();
formData.append("avatar", file);
const { ok } = await AvatarUpload.uploadAvatar(formData, this.onProgress);
if (!ok) {
this.alert.content =
"Upload failed - Something went wrong. Try again later.";
return (this.alert.show = true);
}
},
changePassword() {
this.alert.content = "Not implemented yet.";
return (this.alert.show = true);
},
editAvatarBtn() {
if (!this.GDriveLinked) {
return this.$store.dispatch("setPopoutVisibility", {
name: "GDLinkMenu",
visibility: true
});
}
this.$refs.avatarBrowser.click();
}
},
computed: {
...mapState("settingsModule", ["GDriveLinked"]),
user() {
return this.$store.getters.user;
},
avatar() {
return config.domain + "/avatars/" + this.$store.getters.user.avatar;
}
} }
}; };
</script> </script>

View file

@ -144,6 +144,7 @@ export default {
display: flex; display: flex;
flex: 1; flex: 1;
height: 100%; height: 100%;
overflow: auto;
} }
.right { .right {
display: flex; display: flex;
@ -166,6 +167,7 @@ export default {
border-radius: 4px; border-radius: 4px;
margin: 10px; margin: 10px;
box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.13); box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.13);
flex-shrink: 0;
} }
.extendBanner { .extendBanner {
height: 130px; height: 130px;

View file

@ -3,7 +3,7 @@ const config = [
version: 9.2, version: 9.2,
title: "Image cache, more role permissions!", title: "Image cache, more role permissions!",
shortTitle: "", shortTitle: "",
date: "08/01/2019", date: "09/01/2019",
headColor: "#007792", headColor: "#007792",
new: [ new: [
"Image cache has been implimented.", "Image cache has been implimented.",