MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Calibre (https://www.mobileread.com/forums/forumdisplay.php?f=166)
-   -   importing html does not import images (https://www.mobileread.com/forums/showthread.php?t=64062)

reup 12-03-2009 01:50 AM

importing html does not import images
 
hello all,

first the basic :
calibre 0.6.24
OS : linux mandriva 2010
device (not recognised) hp hx2752 with wince 2003

I have created a html ebook with images. when I add it in calibre, it seems to come without the images

I have a index.html and all images are in the same directory that the index file

I tried previously to have the files in a sub-dir, but it did not work as well

I can open the ebook in a browser and I get it complete, with images, but if I add it to calibre then convert it to any format, the images are lost (represented by an empty square)

my prefert format is mobi but I tried epub, pdf.... none came with the images

I created a html file with the table of content as in the FAQ, but I get the dame, with a TOC in front

I converted all the files to a zip file that I draged into calibre the try to convert it but I get an error message during conversion

this is the result from ebook-convert on the console
ebook-convert electronique.zip electronique.mobi
Processing archive...
1% Converting input to HTML...
InputFormatPlugin: HTML Input running on /tmp/calibre_0.6.24_ZCZZCi_plumber/index.html
Language not specified
Creator not specified
Title not specified
Building file list...
34% Running transforms on ebook...
Merging user specified metadata...
Detecting structure...
Auto generated TOC with 0 entries.
Flattening CSS and remapping font sizes...
Traceback (most recent call last):
File "/tmp/init.py", line 48, in <module>
File "/home/kovid/build/calibre/src/calibre/ebooks/conversion/cli.py", line 249, in main
File "/home/kovid/build/calibre/src/calibre/ebooks/conversion/plumber.py", line 804, in run
File "/home/kovid/build/calibre/src/calibre/ebooks/oeb/transforms/flatcss.py", line 123, in __call__
File "/home/kovid/build/calibre/src/calibre/ebooks/oeb/transforms/flatcss.py", line 167, in baseline_spine
ValueError: max() arg is an empty sequence


help ?

kovidgoyal 12-03-2009 02:44 AM

Use relative paths in your html files.

reup 12-03-2009 08:50 AM

hello,

thanks for the reply

this is the kind of code I use in the file, it is relative path I beleive as the images are now in the same directory that the html file

<img alt="Principles of Electricity" src="e101.gif" border="2">

reup

kovidgoyal 12-03-2009 11:33 AM

When you add the html to calibre, does it create a zip file?

reup 12-03-2009 12:36 PM

yes it does,

I went to the library and open the zip file, there is only the html toc file, the main document html file and some files I believe for the database information, but no png, mpg or other image files

I am trying to add the files manually to the zip, I doubt it will work, but who knows ? (you probably :-) )

reup

kovidgoyal 12-03-2009 12:54 PM

That's really strange. Can you zip up and attach your files to a ticket. I'll take a look when I have a moment.

reup 12-03-2009 03:12 PM

unfortunately I cannot, I download this from a site on internet and I am very sure that the copyright forbid me to do that

I am in brazil and have a very small connection, so to learn electronics, it was better for me to download the site (wget) and turn it to ebook for my old ipaq. but I do not want to put myself and you into some juridic issue just because of my thirst for knowledge :-)

I will create a dummy page with images and see if the issue is linked to my system (OS version or other) or if it is linked to some issue with the html that I try to convert

thanks for your time, I will keep you posted here

reup

reup 12-03-2009 03:18 PM

this could help, I try to convert and I looked at the log during conversion :

InputFormatPlugin: HTML Input running on /tmp/calibre_0.6.24_KjclhD_plumber/content.opf
Parsing all content...
Manifest item 'toc.ncx' not found
Parsing electronique.html ...
Parsing index.html ...
Referenced file 'magnet6.jpg' not in manifest
Referenced file 'alt1.jpg' not in manifest
.
.
.

I can confirm that the file magnet6.jpg is in the directory. as well as in the zip file as I copy it manually there

reup

reup 12-03-2009 03:28 PM

content.opf is not referencing the images files. maybe if I could add the lines by hand

toc.ncx does not exist as well :

<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="uuid_id">
<opf:metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier id="uuid_id" opf:scheme="uuid">514f36fe-282c-4e97-890f-5b2a483a3bd1</dc:identifier>
<dc:title>Unknown</dc:title>
<dc:language>en_GB</dc:language>
<dc:creator>Unknown</dc:creator>
</opf:metadata>
<manifest>
<item href="index.html" id="added" media-type="application/xhtml+xml"/>
<item href="electronique.html" id="html" media-type="application/xhtml+xml"/>
<item href="toc.ncx" media-type="application/x-dtbncx+xml" id="ncx"/>
</manifest>
<spine toc="ncx">
<itemref idref="html"/>
</spine>
<guide/>
</package>


reup

kovidgoyal 12-03-2009 05:06 PM

The manifest errors are just warnings. calibre automatically adds missing files to the manifest when converting.

reup 12-04-2009 10:24 PM

kovidgoyal,

I have created a directory with a simple html that load one image (code was taken from my file that does not convert, the image as well), I created a TOC file, then I import the TOC file, got a zip file, I converted it to mobi and it worked well

so it seems that something is wrong in my original html/images

could it be the size ? no images are bigger than 50k and the html is 290K but all together it is 1.9Mb

I recently converted it to pdf but the file is 8Mb and the pdf reader on my device is so crap that I cannot read properly the course (I have to scroll left and write or use letters so little that I cannot see them)

I try to convert the pdf to mobi but the images fly all over the place

so I have 2 ideas here

1 there is a size issue
2 there is some codes that stop the conversion

reup

kovidgoyal 12-05-2009 12:04 AM

when you import if the resulting zip file does not contain the images then something in the html is causing a problem

reup 12-08-2009 09:52 PM

after I added the images manually in the zip files, then checked the database and restarted calibre few times, the files is seen now with the right size and the convert works

I just have now to find a way to keep the images at the right size and at the right place

thanks a lot

reup


All times are GMT -4. The time now is 06:35 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.