emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Inline Images Export Bug
Date: Wed, 26 Aug 2015 22:40:29 +0000	[thread overview]
Message-ID: <CAOqdjBfyb_V420wac5NZqr7ZU7fdMexxcNmDu9rUib_Hnt-m4Q@mail.gmail.com> (raw)
In-Reply-To: <87egip1zoe.fsf@gmx.us>

[-- Attachment #1: Type: text/plain, Size: 2670 bytes --]

Okay, I just checked (sorry, had to regenerate the files and that took some
time), and with the current version of Firefox the code I pasted is
unnecessary.

The problem I had with previous Firefox versions is that those decided on a
scale for displaying the SVG that differed from its preferred resolution,
but only if an object tag was used for inclusion; img tags would use the
preferred resolution and everything was fine.

The reason for the pt-to-px arithmetic is that graphviz outputs (or used
to) SVGs with a preferred size specified in pt only, not in px. I'm not
sure, but I think HTML pt and SVG pt don't necessarily agree.

Org mode is generating this tag:

<object type="image/svg+xml" data="org/op-prec.svg" >
Sorry, your browser does not support SVG.</object>

Which looks okay to me. It's browser support that's the issue.

> The problems with the second bit of exported code is that it doesn't
scale the image to fit the block with 50% width (only a small part of the
image is visible)

Is it possible you're using an old browser? I'm on Iceweasel (Firefox)
38.1.0. (The bug was there a year or two ago, so by my standards it's a
recent fix that we shouldn't rely on yet.)

> and you when you right click on the image, you can't view it, save it or
anything.

Again, I can, using the "This Frame" popup menu.

But clearly that menu name is misleading and confusing in this case! And I
think that is reason enough to stick with the img tag for now: Firefox
users can't save the image unless they telepathically know that "frame"
means "image". "This Object" might be okay, I guess.

My suggestion is to use img for images; that also appears to be the
consensus on Stack Overflow. Let's find a good syntax for including
interactive objects in Org mode, though.

On Wed, Aug 26, 2015 at 9:56 PM, Rasmus <rasmus@gmx.us> wrote:

> Hi,
>
> Pip Cet <pipcet@gmail.com> writes:
>
> >     let found = false;
> >     for (let el of svgdoc.getElementsByTagName("svg")) {
> >         let width = el.getAttribute("width");
> >         let height = el.getAttribute("height");
> >
> >         let width_pt = width.match(/^([0-9]*)pt$/)[1];
> >         let height_pt = height.match(/^([0-9]*)pt$/)[1];
> >
> >         let width_px = 5/4 * width_pt;
> >         let height_px = 5/4 * height_pt;
> >
> >         object.setAttribute("width", width_px + "px");
> >         object.setAttribute("height", height_px + "px");
> >         found = true;
>
> So are you saying that Org is changing the size from px to pt?  Can you
> try to explain the problem you observe in words?
>
> Thanks,
> Rasmus
>
> --
> The second rule of Fight Club is: You do not talk about Fight Club
>

[-- Attachment #2: Type: text/html, Size: 3633 bytes --]

  reply	other threads:[~2015-08-26 22:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 17:51 Inline Images Export Bug Scott Randby
2015-08-26 18:06 ` Rasmus
2015-08-26 19:26   ` Scott Randby
2015-08-26 22:35     ` Rasmus
2015-08-26 23:06       ` Scott Randby
2015-08-26 19:39   ` Pip Cet
2015-08-26 21:56     ` Rasmus
2015-08-26 22:40       ` Pip Cet [this message]
2015-08-26 23:13         ` Scott Randby
2015-08-26 19:50   ` Scott Randby
2015-08-27  1:35 ` Nick Dokos

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.orgmode.org/

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

  git send-email \
    --in-reply-to=CAOqdjBfyb_V420wac5NZqr7ZU7fdMexxcNmDu9rUib_Hnt-m4Q@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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/org-mode.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).