org-mode是否支持显示基于URL的inline images时改变图片大小

我知道在org-mode里显示存在本地的inline image时,可以如此控制图片大小:

#+attr_org: :height 50% :width 50%
[[./image.png]]

这样高度和宽度会显示为原图的50%。 但是基于URL的图片如此并无效果:

#+attr_org: :height 50% :width 50%
[[http://example.org/image.png]]

想问有无方法解决这个问题?搜了一圈问了几个朋友,没闻到。 要是org真的不支持,可以给org-mode贡献一下,或者写个小包了。

1 个赞

我这边 org-mode 不会内嵌显示网络图片(本地的没问题),是不是需要特殊的包或者配置?

org-mode原生支持显示网络图片啊,你的网络图片链接是怎么写的?

就把你写的 copy 过来,然后把 url 改成了 emacs-china 那个 logo。

我的就可以显示。你用的Emacs可能有点问题

GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.5.2 (Build 20G95)) of 2021-09-19 也没法显示

@mkvoya @Voleking 不好意思,是我搞错了。

我运行emacs -Q,然后在org里放了图片的链接,的确无法显示。

我先调查一下是装了什么包让我的Emacs可以显示网络图片了。

@mkvoya @mkvoya 你们需要设置org-display-remote-inline-image'download或者'cache来显示基于网络链接的图片。这个变量的文档:

org-display-remote-inline-images is a variable defined in org.el.

Value
download

Original Value
skip

Set Customize

Documentation
How to display remote inline images.

Possible values of this option are:

skip        Don't display remote images.
download    Always download and display remote images.
cache       Display remote images, and open them in separate buffers
            for caching.  Silently update the image buffer when a file
            change is detected.

This variable was added, or its default value changed, in Org version
9.4.

References
References in org.el:
(defcustom org-display-remote-inline-images ...) 1 reference
(defun org--create-inline-image ...)             1 reference

Find all references

Debugging
Forget

Source Code
;; Defined in ~/sdk/config/emacs/emacs.d-doom/.local/straight/repos/org/lisp/org.el
(defcustom org-display-remote-inline-images 'skip
  "How to display remote inline images.
Possible values of this option are:

skip        Don't display remote images.
download    Always download and display remote images.
cache       Display remote images, and open them in separate buffers
            for caching.  Silently update the image buffer when a file
            change is detected."
  :group 'org-appearance
  :package-version '(Org . "9.4")
  :type '(choice
	  (const :tag "Ignore remote images" skip)
	  (const :tag "Always display remote images" download)
	  (const :tag "Display and silently update remote images" cache))
  :safe #'symbolp)

Symbol Properties
custom-package-version
  (Org . "9.4")
custom-requests
  nil
custom-type
  (choice
   (const :tag "Ignore remote images" skip)
   (const :tag "Always display remote images" download)
   (const :tag "Display and silently update remote images" cache))
safe-local-variable
  symbolp
standard-value
  ((funcall
    #'#[0 "\300\207"
          [skip]
          1 ""]))
variable-documentation
  "How to display remote inline images.\nPossible values of this option are:\n\nskip        Don't display remote images.\ndownload    Always download and display remote images.\ncache       Display remote images, and open them in separate buffers\n            for caching.  Silently update the image buffer when a file\n            change is detected."
3 个赞

你是用的 doom 吧?这个 org-display-remote-inline-images 曾经在 telegram 讨论过,是支持透过 tramp 来显示图片。

org-mode 9.4支持了这个特性,我可以显示remote inline image,问题是如何显示的时候resize一下

org 9.5 没办法复现啊

* headline1

[[https://emacs-china.org/uploads/default/original/2X/d/d1eb2e7951678b54a51e27e02c067078c57168c5.png]]

在打开这个 org 文件前已经设置 org-display-remote-inline-images'download

我也没办法复现, org 显示不了 remote 图片, 正在找解决办法…

我用这个帖子的方法,让org显示图床图片,但是不知道该怎么控制在线图片大小 :rofl:

是否可以显示在线图像?- Emacs Stack Exchange

图床图片
[[img:https://emacs-china.org/uploads/default/original/2X/d/d1eb2e7951678b54a51e27e02c067078c57168c5.png]]
本地图片
[[file:d:/test.png]]

显示效果如下