-
Notifications
You must be signed in to change notification settings - Fork 405
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
Assets - Allow local upload #136
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…-is/webstudio-designer into upload-assets-pt1
apps/designer/app/designer/features/sidebar-left/panels/image-upload.tsx
Show resolved
Hide resolved
apps/designer/app/designer/features/sidebar-left/panels/image-upload.tsx
Outdated
Show resolved
Hide resolved
apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
Outdated
Show resolved
Hide resolved
apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
Outdated
Show resolved
Hide resolved
…upload.tsx Co-authored-by: Oleg Isonen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there
…-designer into upload-assets-pt1
Co-authored-by: Oleg Isonen <[email protected]>
|
||
# relative to the public directory | ||
FILE_UPLOAD_PATH="uploads" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we allow upload anywhere? without contraining to public directory? idk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it won't work outside of public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enforced by remix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yap
apps/designer/app/designer/features/sidebar-left/panels/image-upload.tsx
Outdated
Show resolved
Hide resolved
type ImageUpload = z.infer<typeof ImageUpload>; | ||
|
||
export const action: ActionFunction = async ({ request, params }) => { | ||
const uploads = path.join(__dirname, "../public"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't use __dirname (logic where to upload shouldn't depend on where this code is, if we mode code it breaks), also I think this is still the wrong path to public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not, it works
But what should I use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there anything in env that we can use? kinda need to have a stable reference to a root somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Messaed this on discord bt this dirname is the build and thats stable
const data = { | ||
type: imageInfo.type, | ||
name: imageInfo.name, | ||
path: `/${path.join(folderInPublic, imageInfo.name)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you wanna put path into database? we can always have a path based on the file name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is imageInfo.name having a unique part in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is unique but that's mostly because then to show it in the frontend you don't have to check if the user is using S3 or wtv you can just have the path as src
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the frontend you want to show the image name, not the path, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Adds support for local uploads
Related to #37