public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How could I add an image in title_page?
@ 2013-05-03 22:52 Feng LI
       [not found] ` <c55d256f-e82a-4b8a-8aa3-7190e088db74-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Feng LI @ 2013-05-03 22:52 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi all,

I would like add an image in the title page (highlight part) in the 
generated epub file. Something like this:

$if(titlepage)$
  <h1 class="title">$title$</h1>
$for(author)$
  <h2 class="author">$author$</h2>
$endfor$
$if(date)$
  <h3 class="date">$date$</h3>
$endif$
<div class="my-logo"><img src="mylogo.gif" /></div>

But couldn't figure how to refer to an image in the template since all 
images are renamed after processing by pandoc?

Thanks,
Feng

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/rEn4d4qZaEgJ.
For more options, visit https://groups.google.com/groups/opt_out.



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

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

* Re: How could I add an image in title_page?
       [not found] ` <c55d256f-e82a-4b8a-8aa3-7190e088db74-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2013-05-04  2:08   ` John MacFarlane
       [not found]     ` <20130504020837.GC18967-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
  2014-05-20 10:17   ` Russ
  1 sibling, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2013-05-04  2:08 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Feng LI [May 03 13 15:52 ]:
>    Hi all,
> 
>    I would like add an image in the title page (highlight part) in the
>    generated epub file. Something like this:
> 
>    $if(titlepage)$
>      <h1 class="title">$title$</h1>
>    $for(author)$
>      <h2 class="author">$author$</h2>
>    $endfor$
>    $if(date)$
>      <h3 class="date">$date$</h3>
>    $endif$
>    <div class="my-logo"><img src="mylogo.gif" /></div>
> 
>    But couldn't figure how to refer to an image in the template since all
>    images are renamed after processing by pandoc?

I suppose you could use a data: URL.  (To get the code for this,
try

echo "![](mylogo.gif)" | pandoc --self-contained


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

* Re: How could I add an image in title_page?
       [not found]     ` <20130504020837.GC18967-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
@ 2014-05-11 11:56       ` Russ
       [not found]         ` <83fcb9e5-f974-4520-8b5b-f3359d4d3869-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Russ @ 2014-05-11 11:56 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I want to do something similar, but I'm not really sure I understood the 
answer. 

Basically we want to use a small version of the cover image on the title 
page (we could size using css.)
We'd ideally like to use only one image because of size.

If I examine a built epub book, I can see the cover image  in in 
'../Images/cover-image.jpg'

I initially thought I'd just include a link to it in the default.epub 
template, something like

```html
  <div class="cover-image-small">
    <img alt="cover image" src="../Images/cover-image.jpg" />
  </div>
```
But when I build that and validate using epubcheck (v2.0.1)
I get errors:

```
Validating against EPUB version 2.0
ERROR: aj-hall-test-book.epub: could not parse title_page.xhtml: Invalid 
path: ../Images/cover-image.jpg
```

Anyone have any ideas, even a more idiot-proof explanation of the previous 
answer would be much appreciated.


On Saturday, 4 May 2013 03:08:37 UTC+1, fiddlosopher wrote:
>
> +++ Feng LI [May 03 13 15:52 ]: 
> >    Hi all, 
> > 
> >    I would like add an image in the title page (highlight part) in the 
> >    generated epub file. Something like this: 
> > 
> >    $if(titlepage)$ 
> >      <h1 class="title">$title$</h1> 
> >    $for(author)$ 
> >      <h2 class="author">$author$</h2> 
> >    $endfor$ 
> >    $if(date)$ 
> >      <h3 class="date">$date$</h3> 
> >    $endif$ 
> >    <div class="my-logo"><img src="mylogo.gif" /></div> 
> > 
> >    But couldn't figure how to refer to an image in the template since 
> all 
> >    images are renamed after processing by pandoc? 
>
> I suppose you could use a data: URL.  (To get the code for this, 
> try 
>
> echo "![](mylogo.gif)" | pandoc --self-contained 
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/83fcb9e5-f974-4520-8b5b-f3359d4d3869%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: How could I add an image in title_page?
       [not found]         ` <83fcb9e5-f974-4520-8b5b-f3359d4d3869-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2014-05-11 16:38           ` Matthew Pickering
       [not found]             ` <da2771fa-b941-4ccb-9ed3-24b6d1f33651-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Pickering @ 2014-05-11 16:38 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

What John was referring to was using data urls instead of a relative path. 
Try converting your image into base64 (using something like this<http://webcodertools.com/imagetobase64converter/>) 
and replacing your current image code with what that tool returns.

On Sunday, May 11, 2014 12:56:03 PM UTC+1, Russ wrote:
>
> I want to do something similar, but I'm not really sure I understood the 
> answer. 
>
> Basically we want to use a small version of the cover image on the title 
> page (we could size using css.)
> We'd ideally like to use only one image because of size.
>
> If I examine a built epub book, I can see the cover image  in in 
> '../Images/cover-image.jpg'
>
> I initially thought I'd just include a link to it in the default.epub 
> template, something like
>
> ```html
>   <div class="cover-image-small">
>     <img alt="cover image" src="../Images/cover-image.jpg" />
>   </div>
> ```
> But when I build that and validate using epubcheck (v2.0.1)
> I get errors:
>
> ```
> Validating against EPUB version 2.0
> ERROR: aj-hall-test-book.epub: could not parse title_page.xhtml: Invalid 
> path: ../Images/cover-image.jpg
> ```
>
> Anyone have any ideas, even a more idiot-proof explanation of the previous 
> answer would be much appreciated.
>
>
> On Saturday, 4 May 2013 03:08:37 UTC+1, fiddlosopher wrote:
>>
>> +++ Feng LI [May 03 13 15:52 ]: 
>> >    Hi all, 
>> > 
>> >    I would like add an image in the title page (highlight part) in the 
>> >    generated epub file. Something like this: 
>> > 
>> >    $if(titlepage)$ 
>> >      <h1 class="title">$title$</h1> 
>> >    $for(author)$ 
>> >      <h2 class="author">$author$</h2> 
>> >    $endfor$ 
>> >    $if(date)$ 
>> >      <h3 class="date">$date$</h3> 
>> >    $endif$ 
>> >    <div class="my-logo"><img src="mylogo.gif" /></div> 
>> > 
>> >    But couldn't figure how to refer to an image in the template since 
>> all 
>> >    images are renamed after processing by pandoc? 
>>
>> I suppose you could use a data: URL.  (To get the code for this, 
>> try 
>>
>> echo "![](mylogo.gif)" | pandoc --self-contained 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/da2771fa-b941-4ccb-9ed3-24b6d1f33651%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: How could I add an image in title_page?
       [not found]             ` <da2771fa-b941-4ccb-9ed3-24b6d1f33651-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2014-05-11 18:54               ` Russ
  0 siblings, 0 replies; 8+ messages in thread
From: Russ @ 2014-05-11 18:54 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Thanks for your help, I now see what John meant.

On Sunday, 11 May 2014 17:38:14 UTC+1, Matthew Pickering wrote:
>
> What John was referring to was using data urls instead of a relative path. 
> Try converting your image into base64 (using something like this<http://webcodertools.com/imagetobase64converter/>) 
> and replacing your current image code with what that tool returns.
>
> On Sunday, May 11, 2014 12:56:03 PM UTC+1, Russ wrote:
>>
>> I want to do something similar, but I'm not really sure I understood the 
>> answer. 
>>
>> Basically we want to use a small version of the cover image on the title 
>> page (we could size using css.)
>> We'd ideally like to use only one image because of size.
>>
>> If I examine a built epub book, I can see the cover image  in in 
>> '../Images/cover-image.jpg'
>>
>> I initially thought I'd just include a link to it in the default.epub 
>> template, something like
>>
>> ```html
>>   <div class="cover-image-small">
>>     <img alt="cover image" src="../Images/cover-image.jpg" />
>>   </div>
>> ```
>> But when I build that and validate using epubcheck (v2.0.1)
>> I get errors:
>>
>> ```
>> Validating against EPUB version 2.0
>> ERROR: aj-hall-test-book.epub: could not parse title_page.xhtml: Invalid 
>> path: ../Images/cover-image.jpg
>> ```
>>
>> Anyone have any ideas, even a more idiot-proof explanation of the 
>> previous answer would be much appreciated.
>>
>>
>> On Saturday, 4 May 2013 03:08:37 UTC+1, fiddlosopher wrote:
>>>
>>> +++ Feng LI [May 03 13 15:52 ]: 
>>> >    Hi all, 
>>> > 
>>> >    I would like add an image in the title page (highlight part) in the 
>>> >    generated epub file. Something like this: 
>>> > 
>>> >    $if(titlepage)$ 
>>> >      <h1 class="title">$title$</h1> 
>>> >    $for(author)$ 
>>> >      <h2 class="author">$author$</h2> 
>>> >    $endfor$ 
>>> >    $if(date)$ 
>>> >      <h3 class="date">$date$</h3> 
>>> >    $endif$ 
>>> >    <div class="my-logo"><img src="mylogo.gif" /></div> 
>>> > 
>>> >    But couldn't figure how to refer to an image in the template since 
>>> all 
>>> >    images are renamed after processing by pandoc? 
>>>
>>> I suppose you could use a data: URL.  (To get the code for this, 
>>> try 
>>>
>>> echo "![](mylogo.gif)" | pandoc --self-contained 
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/345dfff1-dd39-4aa9-862b-09d4cc0d2dd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: How could I add an image in title_page?
       [not found] ` <c55d256f-e82a-4b8a-8aa3-7190e088db74-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2013-05-04  2:08   ` John MacFarlane
@ 2014-05-20 10:17   ` Russ
       [not found]     ` <047bbd40-b9d1-4bf6-98e8-62d4c5a4104d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Russ @ 2014-05-20 10:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

In the end, at least for Epub2 it was easy, just add it to your epub 
template like the cover is added to the cover page. 
This is assuming you have a cover image and Pandoc generates the 
'cover-image.jpg' name for it.

So in the %title% section of your template add something like...
 <div class="cover-image-small">
    <img src="cover-image.jpg" alt="small cover image" />
  </div>

You may of course want to shrink the div size, maybe 16% or so and give it 
a little box shadow looks nice.

Hope this helps someone,

Russ

On Friday, 3 May 2013 23:52:09 UTC+1, Feng LI wrote:
>
> Hi all
>
> I would like add an image in the title page (highlight part) in the 
> generated epub file. Something like this:
>
> $if(titlepage)$
>   <h1 class="title">$title$</h1>
> $for(author)$
>   <h2 class="author">$author$</h2>
> $endfor$
> $if(date)$
>   <h3 class="date">$date$</h3>
> $endif$
> <div class="my-logo"><img src="mylogo.gif" /></div>
>
> But couldn't figure how to refer to an image in the template since all 
> images are renamed after processing by pandoc?
>
> Thanks,
> Feng
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/047bbd40-b9d1-4bf6-98e8-62d4c5a4104d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: How could I add an image in title_page?
       [not found]     ` <047bbd40-b9d1-4bf6-98e8-62d4c5a4104d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2014-05-20 10:21       ` Russ
  2014-05-20 18:29       ` John MacFarlane
  1 sibling, 0 replies; 8+ messages in thread
From: Russ @ 2014-05-20 10:21 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

That should have been $titlepage$ section, sorry

On Tuesday, 20 May 2014 11:17:53 UTC+1, Russ wrote:
>
> In the end, at least for Epub2 it was easy, just add it to your epub 
> template like the cover is added to the cover page. 
> This is assuming you have a cover image and Pandoc generates the 
> 'cover-image.jpg' name for it.
>
> So in the %title% section of your template add something like...
>  <div class="cover-image-small">
>     <img src="cover-image.jpg" alt="small cover image" />
>   </div>
>
> You may of course want to shrink the div size, maybe 16% or so and give it 
> a little box shadow looks nice.
>
> Hope this helps someone,
>
> Russ
>
> On Friday, 3 May 2013 23:52:09 UTC+1, Feng LI wrote:
>>
>> Hi all
>>
>> I would like add an image in the title page (highlight part) in the 
>> generated epub file. Something like this:
>>
>> $if(titlepage)$
>>   <h1 class="title">$title$</h1>
>> $for(author)$
>>   <h2 class="author">$author$</h2>
>> $endfor$
>> $if(date)$
>>   <h3 class="date">$date$</h3>
>> $endif$
>> <div class="my-logo"><img src="mylogo.gif" /></div>
>>
>> But couldn't figure how to refer to an image in the template since all 
>> images are renamed after processing by pandoc?
>>
>> Thanks,
>> Feng
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4ec51661-ead4-4355-9aa8-1232c8ddd2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: How could I add an image in title_page?
       [not found]     ` <047bbd40-b9d1-4bf6-98e8-62d4c5a4104d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2014-05-20 10:21       ` Russ
@ 2014-05-20 18:29       ` John MacFarlane
  1 sibling, 0 replies; 8+ messages in thread
From: John MacFarlane @ 2014-05-20 18:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Russ [May 20 14 03:17 ]:
>   In the end, at least for Epub2 it was easy, just add it to your epub
>   template like the cover is added to the cover page.
>   This is assuming you have a cover image and Pandoc generates the
>   'cover-image.jpg' name for it.

Note -- in the development version (and future releases),
pandoc will preserve the original filename of the cover image,
rather than renaming it to cover-image.  The path will be e.g.
media/lalune.jpg


>   So in the %title% section of your template add something like...
>    <div class="cover-image-small">
>       <img src="cover-image.jpg" alt="small cover image" />
>     </div>
>   You may of course want to shrink the div size, maybe 16% or so and give
>   it a little box shadow looks nice.
>   Hope this helps someone,
>   Russ
>   On Friday, 3 May 2013 23:52:09 UTC+1, Feng LI wrote:
>
>   Hi all
>
>     I would like add an image in the title page (highlight part) in the
>     generated epub file. Something like this:
>
>   $if(titlepage)$
>     <h1 class="title">$title$</h1>
>   $for(author)$
>     <h2 class="author">$author$</h2>
>   $endfor$
>   $if(date)$
>     <h3 class="date">$date$</h3>
>   $endif$
>   <div class="my-logo"><img src="mylogo.gif" /></div>
>
>   But couldn't figure how to refer to an image in the template since all
>   images are renamed after processing by pandoc?
>
>   Thanks,
>
>   Feng
>
>   --
>   You received this message because you are subscribed to the Google
>   Groups "pandoc-discuss" group.
>   To unsubscribe from this group and stop receiving emails from it, send
>   an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/047bbd40-b9d1-4bf6-
>   98e8-62d4c5a4104d%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/047bbd40-b9d1-4bf6-98e8-62d4c5a4104d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

end of thread, other threads:[~2014-05-20 18:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-03 22:52 How could I add an image in title_page? Feng LI
     [not found] ` <c55d256f-e82a-4b8a-8aa3-7190e088db74-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2013-05-04  2:08   ` John MacFarlane
     [not found]     ` <20130504020837.GC18967-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
2014-05-11 11:56       ` Russ
     [not found]         ` <83fcb9e5-f974-4520-8b5b-f3359d4d3869-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2014-05-11 16:38           ` Matthew Pickering
     [not found]             ` <da2771fa-b941-4ccb-9ed3-24b6d1f33651-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2014-05-11 18:54               ` Russ
2014-05-20 10:17   ` Russ
     [not found]     ` <047bbd40-b9d1-4bf6-98e8-62d4c5a4104d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2014-05-20 10:21       ` Russ
2014-05-20 18:29       ` John MacFarlane

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 NNTP newsgroup(s).