orgzly-android icon indicating copy to clipboard operation
orgzly-android copied to clipboard

Support org attachments

Open nashamri opened this issue 8 years ago • 20 comments
trafficstars

First, thank you so much for open-sourcing this awesome app :+1:

This is a feature request and not an issue. I did ask for this in orgzly g+ page.

Here is a little reference video for org attachments: https://www.youtube.com/embed/KMlp9HUJI3s?ecver=1

My basic use case is using the phone camera to capture a picture of a document and attaching it to a task. Similar to what you can do with evernote, for example. Here is a video of this feature in evernote in action: https://youtu.be/QGj7Sq0Qlxk?t=58

Cheers!

nashamri avatar Feb 12 '17 22:02 nashamri

Let's see...

bmtKIA6 avatar Mar 21 '17 01:03 bmtKIA6

+1 This would broaden the application range of orgzly a lot!

biosaat avatar Sep 12 '17 08:09 biosaat

It would be so awesome if you could attach images directly from clipboard. And maybe (that's probably asking too much) if it's possible to take photos and handwritten notes on the spot - that would be totally mind-blowing. Then you can take notes anywhere - even during a math lecture or something like that. Especially if you have a stylus (hello Galaxy Note)

agzam avatar Oct 10 '17 19:10 agzam

#147 #170

bibbs avatar Feb 23 '18 11:02 bibbs

Org mode Version 9.3

Org-Attach has been refactored and extended

Org attach has been refactored and the functionality extended. It should now be easier to understand how it works. A few improvements and extra options have been added as well.

From the initial comment in org-attach source-code:

Attachments are managed either by using a custom property DIR or by using property ID from org-id. When DIR is defined, a location in the filesystem is directly attached to the outline node. When org-id is used, attachments are stored in a folder named after the ID, in a location defined by org-attach-id-dir. DIR has precedence over ID when both parameters are defined for the current outline node (also when inherited parameters are taken into account).

https://orgmode.org/Changes.html

Ypot avatar Dec 11 '19 16:12 Ypot

I'm interested in working on this. My understanding of the use cases are mainly two

  1. When inside a note, insert a photo by launching the camera app
  2. From another app, share a photo to orgzly to save it in a new note

In both cases, save the file as a copy locally in the org repository

Am I describing the use cases accurately? Interested to hear more

xiaoruoruo avatar Nov 21 '20 06:11 xiaoruoruo

Couldn't the second use case be tweaked to allow selecting any file, instead of just an image?

daraul avatar Nov 21 '20 12:11 daraul

I'm interested in working on this. My understanding of the use cases are mainly two

  1. When inside a note, insert a photo by launching the camera app
  2. From another app, share a photo to orgzly to save it in a new note

In both cases, save the file as a copy locally in the org repository

Am I describing the use cases accurately? Interested to hear more

As mentioned above, any file should be attached. Like attachments of an e-mail software.

Where seems to lie one difficulty is in the compatibility of paths and syntax between orgmode and orgzly.

Ypot avatar Nov 21 '20 16:11 Ypot

In both cases, save the file as a copy locally in the org repository

Right. Save a copy of the file. Or move the file. (Personally I never use links here). https://orgmode.org/manual/Attachment-defaults-and-dispatcher.html#Attachment-defaults-and-dispatcher

Not sure what you mean by “org repository”. Ideally this results in the same directory structure that org-mode creates: A “data” directory with a two-level subfolder structure for all uuids. Each node/heading that has at least one attachment gets a uuid as ID property. Thus one can change the node’s name without the attachment folder having to be touched.

biosaat avatar Nov 21 '20 20:11 biosaat

Where seems to lie one difficulty is in the compatibility of paths and syntax between orgmode and orgzly.

Looks like there might be two different desires on managing the paths?

Ideally this results in the same directory structure that org-mode creates: A “data” directory with a two-level subfolder structure for all uuids. Each node/heading that has at least one attachment gets a uuid as ID property. Thus one can change the node’s name without the attachment folder having to be touched.

This is one way, I understand it is the org-attach way. The file is stored in a two-level subfolder within "data", and accessed via "attachment:" Link. This will be a bit more work to fully implement because orgzly currently don't know how to resolve "attachment:" links.

* Heading
:PROPERTIES:
:ID: 82bd9766-d8bd-418f-a5bb-5c569e488915
:END:
[[attachment:image.jpg]]

(The file image.jpg lives in a subfolder data/82/82bd9766-d8bd-418f-a5bb-5c569e488915)

The other way is simply storing the file into one subfolder that holds all attachments. The file can then be accessed via "file:" Link. With #496 implemented, user can control where the subfolder is to resolve the relative path starting with "file:".

* Heading
[[file:image.jpg]]

(The file image.jpg lives in the same folder as the org file)

Which one of the two ways to organize the paths would we prioritize for?

xiaoruoruo avatar Nov 21 '20 22:11 xiaoruoruo

Actually #582 already supported use case 2: receiving shared image and link to the (absolute) path of the content. But it lacks the ability to copy the image.

xiaoruoruo avatar Nov 21 '20 23:11 xiaoruoruo

:ID: 82bd9766-d8bd-418f-a5bb-5c569e488915 (The file image.jpg lives in a subfolder data/82/82bd9766-d8bd-418f-a5bb-5c569e488915)

It would actually be in data/82/bd9766-d8bd-418f-a5bb-5c569e488915/, since the first two characters aren't used in the name of the subdirectory.

VojtechStep avatar Nov 22 '20 12:11 VojtechStep

Which one of the two ways to organize the paths would we prioritize for?

I would clearly prioritze the first way (uuids and “attachment:“-links). Like this it becomes really easy to quickly add a new note, add the attachment, and forget about it. The charming part of this way is that the user does not have to worry about the attachment directory at all.

In org I often don’t bother linking files - I just move them into the attachment directory of a new node without even renaming them.

biosaat avatar Nov 23 '20 10:11 biosaat

Which one of the two ways to organize the paths would we prioritize for?

I would clearly prioritze the first way (uuids and “attachment:“-links). Like this it becomes really easy to quickly add a new note, add the attachment, and forget about it. The charming part of this way is that the user does not have to worry about the attachment directory at all.

In org I often don’t bother linking files - I just move them into the attachment directory of a new node without even renaming them.

How would it work if you share a file to Orgzly, from a different app?

Ypot avatar Nov 23 '20 14:11 Ypot

When receiving a file from a different app, Orgzly can choose to save a copy. Normally it cannot delete or move the shared file.

We need to consider whether the existing behavior as in #582 needs to be supported in some way - it simply add the link of the shared file name into the note content without copying.

xiaoruoruo avatar Nov 23 '20 16:11 xiaoruoruo

When receiving a file from a different app, Orgzly can choose to save a copy. Normally it cannot delete or move the shared file.

We need to consider whether the existing behavior as in #582 needs to be supported in some way - it simply add the link of the shared file name into the note content without copying.

I think that behaviour should be optimized, since it is not a relative path (incompatible with orgmode).

Ypot avatar Nov 23 '20 17:11 Ypot

Where seems to lie one difficulty is in the compatibility of paths and syntax between orgmode and orgzly.

Looks like there might be two different desires on managing the paths?

Ideally this results in the same directory structure that org-mode creates: A “data” directory with a two-level subfolder structure for all uuids. Each node/heading that has at least one attachment gets a uuid as ID property. Thus one can change the node’s name without the attachment folder having to be touched.

This is one way, I understand it is the org-attach way. The file is stored in a two-level subfolder within "data", and accessed via "attachment:" Link. This will be a bit more work to fully implement because orgzly currently don't know how to resolve "attachment:" links.

* Heading
:PROPERTIES:
:ID: 82bd9766-d8bd-418f-a5bb-5c569e488915
:END:
[[attachment:image.jpg]]

(The file image.jpg lives in a subfolder data/82/82bd9766-d8bd-418f-a5bb-5c569e488915)

The other way is simply storing the file into one subfolder that holds all attachments. The file can then be accessed via "file:" Link. With #496 implemented, user can control where the subfolder is to resolve the relative path starting with "file:".

* Heading
[[file:image.jpg]]

(The file image.jpg lives in the same folder as the org file)

Which one of the two ways to organize the paths would we prioritize for?

I am using attachments more intensively on orgmode lately. It seems to me that orgzly should resolve "attachment" links for compatibility.

It is very fast to create links using attachments feature. Orgmode looks if there is a PROPERTY with a DIR (or ID) and searchs in it the linked or to be linked file. And it can have inheritance, like tags, so there is no needed to add a PROPERTY in every heading.

* Attachments
:PROPERTIES:
:DIR:      data/MULTIMEDIA/
:END:
[[attachment:image.jpg]]

** org-attach-use-inheritance
[[attachment:image.jpg]]
* Attachments 2
:PROPERTIES:
:ID:       20210328T171842.438103
:END:
[[attachment:image.jpg]]

** org-attach-use-inheritance
[[attachment:image.jpg]]

Ypot avatar Mar 28 '21 15:03 Ypot

Is this feature finished?

Doerthous avatar Jul 26 '22 12:07 Doerthous

Which one of the two ways to organize the paths would we prioritize for?

I prefer the first one, because I don't want to redefine an attachment data management, like how to naming the attachment folder. But the second is simple for implementation.

Doerthous avatar Jul 28 '22 02:07 Doerthous

https://github.com/orgzly/orgzly-android/issues/1#issuecomment-731648145

Which one of the two ways to organize the paths would we prioritize for?

I prefer the first one, because I don't want to redefine an attachment data management, like how to naming the attachment folder. But the second is simple for implementation.

Doerthous avatar Jul 28 '22 02:07 Doerthous

Where seems to lie one difficulty is in the compatibility of paths and syntax between orgmode and orgzly.

Looks like there might be two different desires on managing the paths?

Ideally this results in the same directory structure that org-mode creates: A “data” directory with a two-level subfolder structure for all uuids. Each node/heading that has at least one attachment gets a uuid as ID property. Thus one can change the node’s name without the attachment folder having to be touched.

This is one way, I understand it is the org-attach way. The file is stored in a two-level subfolder within "data", and accessed via "attachment:" Link. This will be a bit more work to fully implement because orgzly currently don't know how to resolve "attachment:" links.

* Heading
:PROPERTIES:
:ID: 82bd9766-d8bd-418f-a5bb-5c569e488915
:END:
[[attachment:image.jpg]]

(The file image.jpg lives in a subfolder data/82/82bd9766-d8bd-418f-a5bb-5c569e488915)

The other way is simply storing the file into one subfolder that holds all attachments. The file can then be accessed via "file:" Link. With #496 implemented, user can control where the subfolder is to resolve the relative path starting with "file:".

* Heading
[[file:image.jpg]]

(The file image.jpg lives in the same folder as the org file)

Which one of the two ways to organize the paths would we prioritize for?

Hi

Maybe you could implement firstly the second way?

It would consist just in an option where we would set the attachments path. And orgzly would just have to interpret the "attachment" links.

That would be a good start

Ypot avatar Nov 06 '22 00:11 Ypot