leapchat icon indicating copy to clipboard operation
leapchat copied to clipboard

Feature request: attach pictures to messages

Open elimisteve opened this issue 7 years ago • 8 comments

Implementation: create message tagged with type:picture and, if the user includes a message with the attachment, send that message tagged with type:chatmessage to the server alongside the picture. (This is why we send an array of messages to the server -- so these things can be bundled together.)

Where to add this logic: near https://github.com/cryptag/leapchat/blob/v0.1/src/index.js#L186

elimisteve avatar Apr 22 '17 09:04 elimisteve

send_image

@elimisteve From latest commit. Just appends to DOM without encrypting and sending but it's a starting point. Here: https://github.com/cryptag/leapchat/blob/pictures/src/components/App.js#L386

jimmcgaw avatar May 09 '17 04:05 jimmcgaw

@jimmcgaw Nice!

elimisteve avatar May 09 '17 08:05 elimisteve

  • Need some visual indication that the user has attached a given file, and display its name.

  • Will the images be embedded into the message or sent along separately as a separate payload?

  • Do we want to support files beyond just images? Images can be rendered in markdown via the image tag, w/e it is, other documents will have to be downloadable via link of some kind.

  • How do we validate the accepted file types using react-dropdown?

  • Do we want to allow more than one attachment per message?

  • Images are displayed at inline data, base64-encoded strings, in img tags. Should include mimetype. It's hardcoded for PNGs right now, we should get mimetype of file and send that along with the file.

  • Cap the maximum file size at something reasonable. For larger images, we might shrink the image before encoding and sending. In either case, there should be at least an upper bound that prevents sending entirely, and optionally, perhaps another, lower upper bound above which a resize to smaller size is triggered.

  • Consider file attachment on mobile. I'm not sure about Android, but I don't think iOS allows this kind of attachment. We might need to hide the button for mobile web and wait for native app in order to support this.

jimmcgaw avatar May 12 '17 02:05 jimmcgaw

Will the images be embedded into the message or sent along separately as a separate payload?

We'll definitely keep the markdown message and the attached binary image data in separate miniLock files, but the details will be fuzzy till I work with PostgREST more, which I am doing right now.

elimisteve avatar May 12 '17 03:05 elimisteve

Do we want to support files beyond just images?

Eventually yes, absolutely, but for Thursday let's just handle images (by embedding them).

elimisteve avatar May 12 '17 03:05 elimisteve

Backend: should probably create a files table with a nullable foreign key to messages, nullable so that a file can be sent with no corresponding message, as well as for other, Pursuance-non-chat-related uses.

elimisteve avatar May 23 '17 03:05 elimisteve

Related request: the ability to copy and paste images.

You can do that in Twitter and Facebook in browser

Paste from clipboard, paste from screen shots, etc; it's a real time-saver

elimisteve avatar Aug 25 '17 11:08 elimisteve

@MartyTheeMartian ^^

elimisteve avatar Aug 25 '17 11:08 elimisteve