emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Confused about inline html images
@ 2013-01-13 19:48 John Hendy
  2013-01-13 19:54 ` John Hendy
  0 siblings, 1 reply; 6+ messages in thread
From: John Hendy @ 2013-01-13 19:48 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to recreate this html:

<a href="http://path/to/image.jpg"><img src="http://path/to/image.jpg"
width="400px" /></a>

My approach was like so:

#+attr_html: width="400px"
[[http://path/to/image.jpg][http://path/to/image.jpg]]

From the description at using inline images
(http://orgmode.org/manual/Images-in-HTML-export.html):

#+begin_quote
If the description part itself is a file: link or a http: URL pointing
to an image, this image will be inlined and activated so that clicking
on the image will activate the link. For example, to include a
thumbnail that will link to a high resolution version of the image,
you could use:

     [[file:highres.jpg][file:thumb.jpg]]
#+end_quote

That sounds like my example above should work; the example indicates
that thumb.jpg would be inlined and clicking it would send to
highres.jpg. I'd like http://path/to/image.jpg to be inlined at 400px
but clicking it would make the full size jpg viewable in a browser.

I haven't changed the variable org-export-html-inline-images. It
should be set to the default, which appears to be 'maybe.'


Thanks for any suggestions,
John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Confused about inline html images
  2013-01-13 19:48 Confused about inline html images John Hendy
@ 2013-01-13 19:54 ` John Hendy
  2013-01-13 20:09   ` John Hendy
  2013-01-31  9:45   ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: John Hendy @ 2013-01-13 19:54 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, Jan 13, 2013 at 1:48 PM, John Hendy <jw.hendy@gmail.com> wrote:
> I'm trying to recreate this html:
>
> <a href="http://path/to/image.jpg"><img src="http://path/to/image.jpg"
> width="400px" /></a>
>
> My approach was like so:
>
> #+attr_html: width="400px"
> [[http://path/to/image.jpg][http://path/to/image.jpg]]
>
> From the description at using inline images
> (http://orgmode.org/manual/Images-in-HTML-export.html):
>
> #+begin_quote
> If the description part itself is a file: link or a http: URL pointing
> to an image, this image will be inlined and activated so that clicking
> on the image will activate the link. For example, to include a
> thumbnail that will link to a high resolution version of the image,
> you could use:
>
>      [[file:highres.jpg][file:thumb.jpg]]
> #+end_quote
>
> That sounds like my example above should work; the example indicates
> that thumb.jpg would be inlined and clicking it would send to
> highres.jpg. I'd like http://path/to/image.jpg to be inlined at 400px
> but clicking it would make the full size jpg viewable in a browser.
>
> I haven't changed the variable org-export-html-inline-images. It
> should be set to the default, which appears to be 'maybe.'
>

As usual (right after tinkering a lot and finally mailing the list),
this seems to have just started working, so I'll chalk that up to
something I goofed in my bracket syntax perhaps?

Still one issue: it's applying the attr_html to the wrong bit. Here's
the resultant export output:

#+attr_html: width="400px"
[[http://path/to/file.jpg][http://path/to/file.jpg]]

becomes:

<a href="http://path/to/file.jpg" width="400px"><img
src="http://path/to/file.jpg" alt="file.jpg"/></a>

So the width attr is passed to the link section, not the the img.

Is this a bug?


Thanks,
John

>
> Thanks for any suggestions,
> John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Confused about inline html images
  2013-01-13 19:54 ` John Hendy
@ 2013-01-13 20:09   ` John Hendy
  2013-01-31  9:45   ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: John Hendy @ 2013-01-13 20:09 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, Jan 13, 2013 at 1:54 PM, John Hendy <jw.hendy@gmail.com> wrote:
> On Sun, Jan 13, 2013 at 1:48 PM, John Hendy <jw.hendy@gmail.com> wrote:
>> I'm trying to recreate this html:
>>
>> <a href="http://path/to/image.jpg"><img src="http://path/to/image.jpg"
>> width="400px" /></a>
>>
>> My approach was like so:
>>
>> #+attr_html: width="400px"
>> [[http://path/to/image.jpg][http://path/to/image.jpg]]
>>
>> From the description at using inline images
>> (http://orgmode.org/manual/Images-in-HTML-export.html):
>>
>> #+begin_quote
>> If the description part itself is a file: link or a http: URL pointing
>> to an image, this image will be inlined and activated so that clicking
>> on the image will activate the link. For example, to include a
>> thumbnail that will link to a high resolution version of the image,
>> you could use:
>>
>>      [[file:highres.jpg][file:thumb.jpg]]
>> #+end_quote
>>
>> That sounds like my example above should work; the example indicates
>> that thumb.jpg would be inlined and clicking it would send to
>> highres.jpg. I'd like http://path/to/image.jpg to be inlined at 400px
>> but clicking it would make the full size jpg viewable in a browser.
>>
>> I haven't changed the variable org-export-html-inline-images. It
>> should be set to the default, which appears to be 'maybe.'
>>
>
> As usual (right after tinkering a lot and finally mailing the list),
> this seems to have just started working, so I'll chalk that up to
> something I goofed in my bracket syntax perhaps?

Just kidding. Still getting finnicky results, and don't know why. I'm
getting either:

1) full sized inline image that *does* click/link

2) a properly sized image that does not click/link. Copied directly
from org-mode to make sure I'm not goofing something up by re-writing
the syntax since I can't see it when it's in link-formatted face:

[[http://path/to/image.jpg][http://path/to/image.jpg]]

Produces:

<img src="http://path/to/image.jpg" width="400px"
alt="http://path/to/image.jpg" />

I can't get it to reproduce the big (but properly linked) image
mentioned below at the moment.


John

>
> Still one issue: it's applying the attr_html to the wrong bit. Here's
> the resultant export output:
>
> #+attr_html: width="400px"
> [[http://path/to/file.jpg][http://path/to/file.jpg]]
>
> becomes:
>
> <a href="http://path/to/file.jpg" width="400px"><img
> src="http://path/to/file.jpg" alt="file.jpg"/></a>
>
> So the width attr is passed to the link section, not the the img.
>
> Is this a bug?
>
>
> Thanks,
> John
>
>>
>> Thanks for any suggestions,
>> John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Confused about inline html images
  2013-01-13 19:54 ` John Hendy
  2013-01-13 20:09   ` John Hendy
@ 2013-01-31  9:45   ` Bastien
  2013-02-06 21:53     ` John Hendy
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2013-01-31  9:45 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi John,

John Hendy <jw.hendy@gmail.com> writes:

> Still one issue: it's applying the attr_html to the wrong bit. Here's
> the resultant export output:
>
> #+attr_html: width="400px"
> [[http://path/to/file.jpg][http://path/to/file.jpg]]
>
> becomes:
>
> <a href="http://path/to/file.jpg" width="400px"><img
> src="http://path/to/file.jpg" alt="file.jpg"/></a>

Yes, that's wrong.  I fixed this.  Thanks for reporting it!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Confused about inline html images
  2013-01-31  9:45   ` Bastien
@ 2013-02-06 21:53     ` John Hendy
  2013-02-07  7:38       ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: John Hendy @ 2013-02-06 21:53 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Thu, Jan 31, 2013 at 3:45 AM, Bastien <bzg@altern.org> wrote:
> Hi John,
>
> John Hendy <jw.hendy@gmail.com> writes:
>
>> Still one issue: it's applying the attr_html to the wrong bit. Here's
>> the resultant export output:
>>
>> #+attr_html: width="400px"
>> [[http://path/to/file.jpg][http://path/to/file.jpg]]
>>
>> becomes:
>>
>> <a href="http://path/to/file.jpg" width="400px"><img
>> src="http://path/to/file.jpg" alt="file.jpg"/></a>
>
> Yes, that's wrong.  I fixed this.  Thanks for reporting it!
>

Sorry for the late response. I pulled when you made the change but
hadn't gotten around to testing. Still having odd behavior. The
minimal example:

M-x org-version
Org-mode version 7.9.3e (7.9.3e-910-g33c4f6 @
/home/jwhendy/.elisp/org.git/lisp/)

Emacs installed from Arch Linux main repository (not testing or from source):
$ emacs --version
GNU Emacs 24.2.1


#+begin_src minimal-config
;; set load paths
;; set load dirs and global config options
(add-to-list 'load-path "~/.elisp/org.git/contrib/lisp/")
(add-to-list 'load-path "~/.elisp/org.git/lisp/")
#+end_src

#+begin_src test.org
* A headline

And a random image from imgur:

- full size

[[http://i.imgur.com/tladtBz.jpg][http://i.imgur.com/tladtBz.jpg]]

- with an =attr_html= width passed:

#+attr_html: width="200px"
[[http://i.imgur.com/tladtBz.jpg][http://i.imgur.com/tladtBz.jpg]]
#+end_src

The process:
- emacs -q
- M-x load-file ~/path/to/minimal-config
- C-x C-f ~/path/to/test.org
- C-e h

When I open the file in a browser and view source, this is what I get
for the images portion:

#+begin_src html
<p>
<img src="http://i.imgur.com/tladtBz.jpg"
alt="http://i.imgur.com/tladtBz.jpg" />
</p>
<ul class="org-ul">
<li>with an <code>attr_html</code> width passed:
</li>
</ul>


<p>
<img src="http://i.imgur.com/tladtBz.jpg" width="200px"
alt="http://i.imgur.com/tladtBz.jpg" />
</p>
#+end_src

It looks like it's using my second option for the alt text instead of
using it for a link? Not sure. This was happening to me when I
originally posted to the list about this (as in, I couldn't even get
the images to be clickable, but then magically it worked right after I
posted). Now it seems to be doing the original behavior.

Any suggestions?


John



> --
>  Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Confused about inline html images
  2013-02-06 21:53     ` John Hendy
@ 2013-02-07  7:38       ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2013-02-07  7:38 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi John,

John Hendy <jw.hendy@gmail.com> writes:

> #+attr_html: width="200px"
> [[http://i.imgur.com/tladtBz.jpg][http://i.imgur.com/tladtBz.jpg]]

This is not (and has never been) converted to a link, but to an
image.  Maybe a limitation that we can work on later on.

The fix I pushed is about 

  #+attr_html: width="200px"
  [[http://i.imgur.com/tladtBz.jpg][tladtBz.jpg]]

where width="200px" was attributed to the <a href ...> instead
of the image.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-07  9:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-13 19:48 Confused about inline html images John Hendy
2013-01-13 19:54 ` John Hendy
2013-01-13 20:09   ` John Hendy
2013-01-31  9:45   ` Bastien
2013-02-06 21:53     ` John Hendy
2013-02-07  7:38       ` Bastien

Code repositories for project(s) associated with this 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).