Skip to content
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

📎 Attachments #1051

Open
jjisnow opened this issue Jan 23, 2021 · 21 comments · May be fixed by #1489
Open

📎 Attachments #1051

jjisnow opened this issue Jan 23, 2021 · 21 comments · May be fixed by #1489
Labels
enhancement Server-App depends on changes in the Nextcloud Notes server app

Comments

@jjisnow
Copy link

jjisnow commented Jan 23, 2021

It would be great in the view mode of the notes editor if referenced image files (jpg or animated gifs from ../media/...... ) were displayed.

@stefan-niedermann
Copy link
Member

Depends on nextcloud/notes#74

@stefan-niedermann stefan-niedermann changed the title Feature request: gif/image support 📎 Attachments Jan 24, 2021
@stefan-niedermann stefan-niedermann added the Server-App depends on changes in the Nextcloud Notes server app label Feb 11, 2021
@aryasenna

This comment has been minimized.

@stefan-niedermann

This comment has been minimized.

@aryasenna
Copy link

aryasenna commented Apr 15, 2021

Yes I agree this is not final nor a good solution, but seeing the server app won't implement this anytime soon..

this already works in the latest Notes Android app.

Do you mean we already can take photo from camera/file system then insert it as base64?

(there are tons of characters)

Would wrapping mechanism for the image element be possible..? Also for readable notes it makes sense to resize the image anyway.

I'd try pull request, but my java and Android coding (now they use Kotlin?) is very rusty to say the least.😅

@stefan-niedermann
Copy link
Member

Do you mean we already can take photo from camera/file system then insert it as base64?

This was a sample of an image with only 20kB or so. Now imagine the size of a photo with 5MB. Even compressed and cropped this will be multiple times the character soup od the sample.

Sorry, but this workaround leads into the wrong direction. If we do it, we will do it the right way - everything else will raise expections by the users which we can't fulfill.

Would wrapping mechanism for the image element be possible..? Also for readable notes it makes sense to resize the image anyway.

Unfortunately there is no easy way for the editor to hide such stuff (while it is easy in preview mode).

I'd try pull request, but my java and Android coding (now they use Kotlin?) is very rusty to say the least

Yeah, well, i'd say it's not your fault but Android is a shithole. 😄
Given we don't have file handling implemented yet, and the permission stuff and file authority stuff isn't that easy (if you are not familiar with Android), it won't be easy anyway.

I'd suggest to make a PR to the server app to support the feature the proper way instead. It will probably be more straight forward with less bleeding edges.

@arkadym
Copy link

arkadym commented Aug 10, 2021

Actually i think it should be simpler - just put image same folder to server and reference from the Note.

@DerSaxxe
Copy link

DerSaxxe commented Oct 6, 2021

I found out that you can add an image (within nc) in this way
![Image](/f/UUID)
Is this an "official" way?
Btw, you have to find out the uuid of your image.

@stefan-niedermann
Copy link
Member

stefan-niedermann commented Oct 7, 2021

@SIRSteiner this is an "official" way for the Notes Android app. This is currently only available on F-Droid. It also works for valid paths on your files in your Nextcloud like /foo/bar%20baz.png (where "valid" means that you will have to URL encode <kbdSpaces yourself)

This ain't exactly this issue though because it doesn't allow the upload of attachments and it does only work for images, not for other file types.

@newhinton
Copy link
Contributor

@stefan-niedermann As i experiment in nextcloud/notes#785, where would i need to add link-normalization for markwon? it seems that module is in nextcloud-commons, but i don't think it is reasonable to implement a nextcloud-notes api in a reusable module

@stefan-niedermann
Copy link
Member

stefan-niedermann commented Nov 29, 2021

Good question, i have already thought about it. The remaining issue with your implementation in the context of the Notes Android app is to determine the root for relative paths (currently we only support absolute paths starting at the root or a fully qualified URL.

I guess we need to find a way to configure the GlideModule at runtime for that. I recommend you to focus on the Notes server implementation, we can find a solution for this problem later or parallel.

@newhinton
Copy link
Contributor

Actually, you dont need to do that. (Or i misunderstood the problem)

There wont be a "path" for an image, just an api. So the image can always be accessed by: /notes/image/{id}/{path} and the server does the path-resolution for you. It can calculate where the note is, and where the image should be in relation to that.

So, if you can prepend the full url to the relative path (and change ../ to ;;/) you always get the image.
Does that solve your issue?

@newhinton
Copy link
Contributor

newhinton commented Nov 30, 2021

UrlProcessorRelativeToAbsolute
It was renamed to ImageDestinationProcessorRelativeToAbsolute

Maybe we can expose this to the apps using markdown.
However, as far as i understood it, this would remove ../, which is not working for our case.

We should think about how we can provide custom Link and URL Resolvers to nextcloud apps using your common-implementation, because i could imagine other apps also have the need to resolve relative links in markdown.

Using some sort of interface where we can pass custom Resolvers would allow for apps to extend existing resolvers and pass them to the renderer

@newhinton
Copy link
Contributor

@stefan-niedermann Do you have a good guide on how i would set up a development environment which also has the library in source-format?
I'd like to try to tinker with the android app.

@stefan-niedermann
Copy link
Member

Unfortunately not, sorry, but i only code for the Notes Android client...

@newhinton
Copy link
Contributor

Do you develop nextcloud-commons and the notes app independently?

Otherwise i am going to build the nextclouc-commons library manually and use a local jar in the nextcloud-notes app

@stefan-niedermann
Copy link
Member

They are developed independently (commons is also used by Deck and maybe a few other apps)

@newhinton
Copy link
Contributor

so, to run a modified version of nc-commons i have to make changes, build the library, copy the jar and rebuild the notes app with that jar?

Hm, seems tedious, but thanks anyway!

@stefan-niedermann
Copy link
Member

I think one can link the gradle dependency to another local project, but i unfortunately haven't set up such an environment successfully yet 😕

@newhinton
Copy link
Contributor

@stefan-niedermann nextcloud/notes#785 has been merged, to we can now start working on client side support.

@stefan-niedermann
Copy link
Member

@newhinton are you interested in joining forces here? Maybe we could have a short chat regarding the this? If yes, please contact me via info@niedermann.it 🙂 🚀

@ant0nwax
Copy link

ant0nwax commented Apr 24, 2023

Hi, i would like to add my experience:

(A) I understand that there is an app in F Droid store which I installed on Android 12
(B) I also have installed a Home URL Shortcut from my Brave browser on Android to the Nextcloud Notes server URL. (same Android 12 phone)

I try to find a way to make JPG attachments visible in both. (1)

I try to find a way to create a new note including uploading an attachment. (2)

(1) does only work with (B) in Desktop View, but then I cannot use the Shortcut URL on my Home Page

(2) leads in both cases (A) and (B) to the error

OCA\Notes\Service\ImageNotWritableException

is that expected until 25.0.6 and latest Notes App on Nextcloud or could it work better?

Any experience is helpful

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Server-App depends on changes in the Nextcloud Notes server app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants