Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIU-3047 - max profile picture size (follow-up) #2693

Merged
merged 4 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getRotatedImage, createImage } from './utils/canvasUtils';
import {
ACCEPTED_IMAGE_TYPES,
PROFILE_PIC_API,
PROFILE_PIC_DEFAULT_MAX_SIZE,
PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB,
} from '../../../../../constants';

const ORIENTATION_TO_ANGLE = {
Expand Down Expand Up @@ -110,7 +110,7 @@ const EditUserProfilePicture = ({ profilePictureId, form, personal, profilePictu
};

const onFileChange = async (e) => {
const maxFileSize = profilePictureMaxFileSize || PROFILE_PIC_DEFAULT_MAX_SIZE;
const maxFileSize = profilePictureMaxFileSize || PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB;
const maxFileSizeInBytes = maxFileSize * 1024 * 1024;
if (maxFileSizeInBytes && e.target.files?.length > 0) {
if (e.target.files[0].size > maxFileSizeInBytes) {
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export const DCB_VIRTUAL_USER = {
type: DCB,
};

export const PROFILE_PIC_DEFAULT_MAX_SIZE = 10;
export const PROFILE_PIC_DEFAULT_MAX_SIZE_IN_MB = 10;
export const ACCEPTED_IMAGE_TYPES = 'image/jpg, image/jpeg, image/png';

export const READING_ROOM_ACCESS = {
Expand Down
Loading