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

Support org attachments #1

Open
nashamri opened this issue Feb 12, 2017 · 21 comments · May be fixed by #795
Open

Support org attachments #1

nashamri opened this issue Feb 12, 2017 · 21 comments · May be fixed by #795

Comments

@nashamri
Copy link

First, thank you so much for open-sourcing this awesome app 👍

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!

@bmtKIA6
Copy link

bmtKIA6 commented Mar 21, 2017

Let's see...

@biosaat
Copy link

biosaat commented Sep 12, 2017

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

@agzam
Copy link

agzam commented Oct 10, 2017

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)

@bibbs
Copy link

bibbs commented Feb 23, 2018

#147
#170

@Ypot
Copy link

Ypot commented Dec 11, 2019

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

@xiaoruoruo
Copy link
Contributor

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

@daraul
Copy link

daraul commented Nov 21, 2020

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

@Ypot
Copy link

Ypot commented Nov 21, 2020

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.

@biosaat
Copy link

biosaat commented Nov 21, 2020

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.

@xiaoruoruo
Copy link
Contributor

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
Copy link
Contributor

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.

@VojtechStep
Copy link

: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.

@biosaat
Copy link

biosaat commented Nov 23, 2020

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.

@Ypot
Copy link

Ypot commented Nov 23, 2020

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?

@xiaoruoruo
Copy link
Contributor

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.

@Ypot
Copy link

Ypot commented Nov 23, 2020

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
Copy link

Ypot commented Mar 28, 2021

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]]

@Doerthous
Copy link

Is this feature finished?

@Doerthous
Copy link

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
Copy link

#1 (comment)

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.

@Ypot
Copy link

Ypot commented Nov 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.