Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 12:19 PM   #1
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 84
Karma: 10
Join Date: Jul 2023
Device: none
Problem with delete unused media files

Load the attached epub and select tools/delete unused media files. It says that cover.jpeg is unused even though I can see it in the preview window. If I set it as the cover image, it works. This happens on Sigil 2.6.2 and 2.7.0
Attached Files
File Type: epub delete media files.epub (6.4 KB, 6 views)
jwes is offline   Reply With Quote
Old Yesterday, 12:20 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,121
Karma: 6404930
Join Date: Nov 2009
Device: many
Using exact (case sensitive) matching?

Not a bug.

cover.jpg is not equal to Cover.jpg

Code:
<div><div><img src="cover.jpeg" alt="" style="width:100%;"/></div>

But BookBrowser shows the file is actually called "Cover.jpg"

All urls use case sensitive paths. This is the spec. Are you on Windows with a case insensitive file system?


Epubcheck should easily detect this case and report it.

Last edited by KevinH; Yesterday at 12:27 PM.
KevinH is online now   Reply With Quote
Advert
Old Yesterday, 12:31 PM   #3
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,413
Karma: 20212733
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I see this all the time when I use an image fleuron in a chapter/scene break. html: <hr class="ChDiv"/>

Sigil won’t detect an image that is used via css. Eg. background src. So watch out for those. Reports show the fleuron used 0 times.
Turtle91 is offline   Reply With Quote
Old Yesterday, 12:38 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,121
Karma: 6404930
Join Date: Nov 2009
Device: many
Sigil should detect if an image is only used in background src in css if the case is an exact match when "deleting unused media" is run. If it doesn't that is a bug!

Or is this issue only happen in Reports?

Either way, please post a short epub test case and I will try to track this bug down and fix it for the next release.

Thanks!

Last edited by KevinH; Yesterday at 12:45 PM.
KevinH is online now   Reply With Quote
Old Yesterday, 12:58 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,121
Karma: 6404930
Join Date: Nov 2009
Device: many
Okay, I checked the Images Reports code and the count value in that Report is only for direct usage by html files not css files. I will expand that count to include direct usage in css files as well in the Images report.

Deleting Unused Media does not use the Reports values in any way. As long as your css includes a proper url() in its property value, it should be handled properly by delete unused media.

Either way a test case would help.

Last edited by KevinH; Yesterday at 01:05 PM.
KevinH is online now   Reply With Quote
Advert
Old Yesterday, 04:25 PM   #6
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 84
Karma: 10
Join Date: Jul 2023
Device: none
Quote:
Originally Posted by KevinH View Post
Using exact (case sensitive) matching?

Not a bug.

cover.jpg is not equal to Cover.jpg

Code:
<div><div><img src="cover.jpeg" alt="" style="width:100%;"/></div>

But BookBrowser shows the file is actually called "Cover.jpg"

All urls use case sensitive paths. This is the spec. Are you on Windows with a case insensitive file system?


Epubcheck should easily detect this case and report it.
That leaves the question "Why does Sigil display the image in the preview window"? I would be more likely to see it if the image didn't show. I am on windows 11.
jwes is offline   Reply With Quote
Old Yesterday, 04:34 PM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,121
Karma: 6404930
Join Date: Nov 2009
Device: many
Windows (all versions) uses a case insensitive but case preserving file system. Linux is case sensitive and MacOS can easily be either depending on how you format the drive.

So on Windows when Sigil asks for "cover.jpg" the file name returned by the OS could be any of the following as all these names map to the exact same file:

cover.jpg
Cover.jpg
COVER.JPG
CoVeR.jPG
...
etc.

The spec for interpreting a url that resolves to a file path is that it must match in a case sensitive manner: "cover.jpg" only matches to "cover.jpg" and no other variations.

So Windows sees Cover.jpg as the same file as cover.jpg but this is specific to Windows and may not happen in most standalone e-reading devices that are Linux based.

Again, epubcheck checks for mismatches like this to alert you to fix it.

Many developers hate case insensitive file systems and try to avoid them to prevent inadvertant overwriting of files. In my opinion, Windows still being case-insensitive is a real point of aggravation, and something Windows 11 should have finally fixed, but did not. If you ever format a drive in Windows, there must be a way to create a real case-sensitive file system. It is really easy to do on a Mac.

I use a case sensitive file system on my Mac and the "cover.jpg" in your epub does not appear in Preview since it does not exist. It also would break under other e-readers. So stick to case sensitive file names and never use a filename that only differs by case (upper vs lower) of some of the letters, if you want your epub to work everyplace.

Last edited by KevinH; Yesterday at 05:48 PM.
KevinH is online now   Reply With Quote
Old Yesterday, 04:46 PM   #8
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 48,767
Karma: 174510638
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
After cleaning up all the errors around id values in the toc.ncx, epubcheck returned the following:

Code:
main.xhtml	10	338	Col: 61: ERROR(RSC-007): Referenced resource "cover.jpeg" could not be found in the EPUB.
I then looked at the contents of Images where the file was named Cover.jpeg. As mentioned multiple times, case sensitivity matters. On a Linux install, Preview did not show the cover image since the file system is case sensitive. A quick and dirty test on two ereaders (Kobo and Kindle) showed neither would display the cover image unless the case matched (both use Linux as the underlying OS).
DNSB is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Unused Stylesheet Selectors selects all my styles. jwes Sigil 4 05-29-2025 02:28 PM
SVG images marked as "unused media" AlanHK Sigil 5 09-02-2016 01:36 PM
Cleaning unused files in Paperwhite disu93 Amazon Kindle 2 09-14-2013 04:53 AM
delete unused style classess - no scroll bar cybmole Sigil 5 11-08-2012 06:21 AM


All times are GMT -4. The time now is 02:15 PM.


MobileRead.com is a privately owned, operated and funded community.