It might not help because it's in svelte and it doesn't look like you're using lemmy-js-client
, but this is an example of how I do it in Alexandrite using lemmy-js-client
. The onPaste
function handles the paste
event on the markdown editor textarea when someone pastes with an image in their clipboard, and the onFileInputChange
is the change
event for an <input type="file" />
element so when someone selects a file it uploads and the input's label can be styled like a button. Here is the client's fetch function which handles the authorization header and whatnot. You can upload client-side without a proxy server for any instance running a newer version of Lemmy than like.... 0.19.0? I didn't want to be responsible for proxying image uploads so I waited to add image uploading in Alexandrite until I could do the uploads directly client side.
this post was submitted on 04 Feb 2025
4 points (83.3% liked)
Lemmy Apps
5648 readers
23 users here now
A home for discussion of Lemmy apps and tools for all platforms.
RULES:
- No spamming
- Be nice and have fun
- Follow the general lemmy.world rules
An extensive list of Lemmy apps is available here:
Visit our partner Communities!
Lemmy Plugins and Userscripts is a great place to enhance the Lemmy browsing experience. [email protected]
Lemmy Integrations is a community about all integrations with the lemmy API. Bots, Scripts, New Apps, etc. [email protected]
Lemmy Bots and Tools is a place to discuss and show off bots, tools, front ends, etc. you’re making that relate to lemmy. [email protected]
Lemmy App Development is a place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform. [email protected]
founded 2 years ago
MODERATORS