unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joe Corneli via "Emacs development discussions." <emacs-devel@gnu.org>
To: Alan Third <alan@idiocy.org>
Cc: Joost Kremers <joostkremers@fastmail.fm>,
	emacs-devel@gnu.org, telegraph@gmx.com
Subject: Re: SVG with embedded png
Date: Wed, 19 May 2021 13:57:23 +0100	[thread overview]
Message-ID: <874keynaoc.fsf@Proteus> (raw)
In-Reply-To: <YKQB9V/KJ+xeqpeW@idiocy.org>

Alan Third writes:

> More than likely the problem is that the image file isn't within the
> SVG file's sub-tree. Librsvg won't load URLs that aren't in the same
> directory as the SVG file or in a subdirectory.
>
> This is why people grabbing the two files and dumping them in the same
> directory see the image, but if you put the png in /tmp it doesn't.
>
> This is a security feature, apparently.

Thanks Alan!

I can confirm that the following snippet works fully as expected
(assuming that the image placed in the location indicated), via M-x
org-toggle-latex-fragment:

$$\begin{tabular}{cc} \includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png} & \includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png}\end{tabular}$$

8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<

THE BACKSTORY

Gregor had written to me separately to ask what I wanted to achieve by
putting the PNG within the SVG, so I thought I would just to explain
what I was getting at, for completeness.

My goal was to get two images next to each other (which not directly
possible using standard Org mode markup).

I learned that it is possible to get an image and text side-by-side with
a suitable LaTeX fragment (https://emacs.stackexchange.com/a/50633/8406)

That made me wonder if I could get two images side-by-side using a
similar LaTeX trick.  (I don’t have any specific need to embed
everything in SVG, that’s just my usual setting for LaTeX fragments.)
When I noticed the missing image, I thought I had found a bug.

...Now it turns out it wasn’t a bug, but a security feature!

(Aside: I should have posted to the ‘bugs’ list, but it has been a while
since I submitted a bug report so I forgot all about that!)

On reflection: could the strange niche case I found actually motivate
any code or documentation changes in Org?  It seems unlikely, but maybe
there’s something here.  Maybe others have an opinion now that they’ve
seen the story has been presented in full.

> Actually, it does if you use the right option:
>
> (insert-image (create-image "/wherever/your/image/is/Tft.svg" 'svg nil
> :base-uri "/tmp"))


-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).



      parent reply	other threads:[~2021-05-19 12:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 10:45 SVG with embedded png Joe Corneli via Emacs development discussions.
2021-05-18 12:25 ` Eli Zaretskii
2021-05-18 12:50   ` tomas
2021-05-18 12:54   ` Basil L. Contovounesios
2021-05-18 12:40 ` Joost Kremers
2021-05-18 14:24   ` Joe Corneli via Emacs development discussions.
2021-05-18 18:05     ` Alan Third
2021-05-18 18:09       ` Alan Third
2021-05-19 12:57       ` Joe Corneli via Emacs development discussions. [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874keynaoc.fsf@Proteus \
    --to=emacs-devel@gnu.org \
    --cc=alan@idiocy.org \
    --cc=joostkremers@fastmail.fm \
    --cc=joseph.corneli.em@hyperreal.enterprises \
    --cc=telegraph@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).