Drift icon indicating copy to clipboard operation
Drift copied to clipboard

Support uploading images

Open alessandro308 opened this issue 3 years ago • 4 comments

I mean, is there some technical stuff I should take care if I remove the limit on the file type in the uploader component?

alessandro308 avatar Mar 15 '22 15:03 alessandro308

No, there’s no real technical reason except showing them in the preview rendered. It probably makes most sense to do what GH does and upload images into Markdown and just provide a link, but file hosting (rather than just text) is out of scope for this project imo.

MaxLeiter avatar Mar 15 '22 17:03 MaxLeiter

Would converting the image to SVG and embedding it in the file be within scope?

adyanth avatar Mar 28 '22 18:03 adyanth

Probably not, because I feel like the SVGs could be huge compared to the actual image file?

after some thought, I think I am okay with supporting hosting images, but it would require a bit of work. I guess we could embed the image in sqlite, but its probably better to store it as-is and serve it from the folder location on disk. @adyanth any thoughts on this? I appreciate your input 🙏

MaxLeiter avatar Mar 28 '22 20:03 MaxLeiter

The size would be large when using SVG.

I haven't seen any pros/cons on storing images in the DB vs the filesystem to comment on which would be better.

Storing images in a filesystem path (configurable) is good enough which may (in the future if needed) allow something like nginx serve the bulk static content if necessary. Even cache the content if needed.

I would recommend having a separate endpoint for these content. Also, similar to how GitHub does it, would be better to generate a random filename (and strip metadata) for the images before saving it.

adyanth avatar Mar 28 '22 20:03 adyanth