Skip to content

Commit d803868

Browse files
authored
Merge pull request #750 from gitroomhq/feat/disable-image-compression
Disable image compression variable
2 parents ddfad42 + ca2a8af commit d803868

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

apps/frontend/src/app/(app)/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
4848
telegramBotName={process.env.TELEGRAM_BOT_NAME!}
4949
neynarClientId={process.env.NEYNAR_CLIENT_ID!}
5050
isSecured={!process.env.NOT_SECURED}
51+
disableImageCompression={!!process.env.DISABLE_IMAGE_COMPRESSION}
5152
>
5253
<ToltScript />
5354
<FacebookComponent />

apps/frontend/src/components/media/new.uploader.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export function useUppyUploader(props: {
6363
onUploadSuccess: (result: UploadResult) => void;
6464
allowedFileTypes: string;
6565
}) {
66-
const { storageProvider, backendUrl } = useVariables();
66+
const { storageProvider, backendUrl, disableImageCompression } =
67+
useVariables();
6768
const { onUploadSuccess, allowedFileTypes } = props;
6869
const fetch = useFetch();
6970

@@ -83,12 +84,14 @@ export function useUppyUploader(props: {
8384
backendUrl
8485
);
8586
uppy2.use(plugin, options);
86-
uppy2.use(Compressor, {
87-
convertTypes: ['image/jpeg'],
88-
maxWidth: 1000,
89-
maxHeight: 1000,
90-
quality: 1,
91-
});
87+
if (!disableImageCompression) {
88+
uppy2.use(Compressor, {
89+
convertTypes: ['image/jpeg'],
90+
maxWidth: 1000,
91+
maxHeight: 1000,
92+
quality: 1,
93+
});
94+
}
9295
// Set additional metadata when a file is added
9396
uppy2.on('file-added', (file) => {
9497
uppy2.setFileMeta(file.id, {

libraries/react-shared-libraries/src/helpers/variable.context.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface VariableContextInterface {
1818
telegramBotName: string;
1919
neynarClientId: string;
2020
isSecured: boolean;
21+
disableImageCompression: boolean;
2122
tolt: string;
2223
}
2324
const VariableContext = createContext({
@@ -36,6 +37,7 @@ const VariableContext = createContext({
3637
telegramBotName: '',
3738
facebookPixel: '',
3839
neynarClientId: '',
40+
disableImageCompression: false,
3941
tolt: '',
4042
} as VariableContextInterface);
4143

0 commit comments

Comments
 (0)