org-roam / org-roam-ui

A graphical frontend for exploring your org-roam Zettelkasten
GNU General Public License v3.0
1.99k stars 109 forks source link

Display images from org-download #239

Open hy-zhao23 opened 2 years ago

hy-zhao23 commented 2 years ago

I have several separated local roam directories. And with each I set up a separated image folder for it as following:

(add-hook 'dired-mode-hook 'org-download-enable)
(add-hook 'org-mode-hook
          (lambda ()
            (setq-local org-download-image-dir (concat "./.media/" (file-name-sans-extension (file-name-nondirectory  (buffer-name)))))))

The preview in UI graph can not display images from org-download. image

Osherz5 commented 1 year ago

I'm having a similar issue on Windows, trying to display an image linked in the following way: [[C:/project/counts.png]] Instead, the rendered URL in the org-roam-ui sidebar's preview includes my org-roam-directory like so: c:/roam/C:/project/counts.png which of course returns 404

ParetoOptimalDev commented 1 year ago

Try using relative paths like:

[[counts.png]] or [[media/image.jpg]]

Dev380 commented 1 year ago

Org download is using relative paths for me, but they're adding download: in front of them which is messing the ui up. Removing that seems to break the inline display on emacs.

ParetoOptimalDev commented 1 year ago

@Dev380 I don't think org-mode supports inline display of anything except image filepaths.

NOTE: I'm on emacs master, so some or all of my advice may not apply.

See the help for org-display-inline-images:

  2. Its description consists in a single link of the previous
     type.  In this case, that link must be a well-formed plain
     or angle link, i.e., it must have an explicit "file" or
     "attachment" type.

But I just tested the attachment type and couldn't even get it to work. Actually...

If I add a description it breaks it.

Anyway, I think it's not supported or there is a bug but give leaving the description empty a try and see if that works.

ParetoOptimalDev commented 1 year ago

I found that you can fix the problem with descriptions by calling (org-display-inline-images t) which makes INCLUDE-LINKED true.

I'm not sure why it doesn't resolve the link by default and goes by description text...