Skip to content

Commit

Permalink
Merge pull request #1501 from Shelf-nu/1500-bug-inconsistent-image-up…
Browse files Browse the repository at this point in the history
…load

improvement: Increased upload limit to 8mb and slightly increased size of stored image
  • Loading branch information
DonKoko authored Dec 10, 2024
2 parents 992b17f + 265dc7c commit d5be3a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/atoms/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const validateFileAtom = atom(
const file = event?.target?.files?.[0];
if (file) {
const allowedType = verifyAccept(file.type, event.target.accept);
const allowedSize = file.size < 4_000_000;
const allowedSize = file.size < 8_000_000;

if (!allowedType) {
event.target.value = "";
Expand All @@ -22,7 +22,7 @@ export const validateFileAtom = atom(
if (!allowedSize) {
/** Clean the field */
event.target.value = "";
return "Max file size is 4MB";
return "Max file size is 8MB";
}

return undefined;
Expand Down
16 changes: 15 additions & 1 deletion app/components/assets/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ import { AbsolutePositionedHeaderActions } from "../layout/header/absolute-posit
import { Button } from "../shared/button";
import { ButtonGroup } from "../shared/button-group";
import { Card } from "../shared/card";
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "../shared/hover-card";
import { Image } from "../shared/image";
import {
Tooltip,
Expand Down Expand Up @@ -192,7 +197,16 @@ export const AssetForm = ({
) : null}
<div>
<p className="hidden lg:block">
Accepts PNG, JPG or JPEG (max.4 MB)
<HoverCard openDelay={50} closeDelay={50}>
<HoverCardTrigger className={tw("inline-flex w-full ")}>
Accepts PNG, JPG or JPEG (max.8 MB)
</HoverCardTrigger>
<HoverCardContent side="left">
Images will be automatically resized on upload. Width will
be set at 1200px and height will be adjusted accordingly to
keep the aspect ratio.
</HoverCardContent>
</HoverCard>
</p>
<Input
disabled={disabled}
Expand Down
2 changes: 1 addition & 1 deletion app/modules/asset/service.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ export async function updateAssetMainImage({
Date.now()
)}`,
resizeOptions: {
width: 800,
width: 1200,
withoutEnlargement: true,
},
});
Expand Down

0 comments on commit d5be3a2

Please sign in to comment.