|
|
#1 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 83,273
Karma: 153646249
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Bug in Remove unused images
The feature in the editor to remove unused images has a bug. It does not take into account images listed in the CSS that are not being used. That image is not being used yet the option to remove it won't remove it. That class is not being used. The Remove images should look to see if that class is being used and if not, remove the unused image.
Code:
.secbreak {
background: url(../images/secbreak.jpg) no-repeat center;
height: 30px;
border: none;
margin: 0.5em 0;
}
|
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,236
Karma: 29630732
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
as always with bug reports, I need a reproducer you asserting something is so doesnt make it so.
|
|
|
|
|
|
#3 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,803
Karma: 180002898
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For what it may be worth, I created a very simple ePub3 file.
The XHTML file contains: Code:
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title></title> <link href="../Styles/stylesheet.css" type="text/css" rel="stylesheet"/> </head> <body> <hr class="secbreak"/> </body> </html> Code:
.secbreak {
background: url(../Images/secbreak.jpg) no-repeat center;
height: 2em;
border: none;
margin: 0.5em 0;
}
If I edited the CSS entry to use images instead of Images, the image file does show as unused and removable. If I removed the class="secbreak" from the XHTML file, the image is not removed since the unused CSS entry would have to be removed otherwise the image is still referenced by the CSS entry. So basically remove unused CSS rules and then remove unused images works as expected. Last edited by DNSB; 05-09-2026 at 02:36 AM. |
|
|
|
|
|
#4 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,236
Karma: 29630732
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
yeah remove images does not check if css rules match any html, that is done by remove unused css.
|
|
|
|
|
|
#5 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,776
Karma: 13151503
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Then, you have to remove first css and later the image. It makes sense.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Editor Plugin] Remove Unused Images | jandamm | Plugins | 3 | 03-10-2026 05:30 PM |
| Remove unused fonts | juliuss | KOReader | 4 | 09-03-2022 11:00 AM |
| Feature Request: Polish Books, Remove Unused Images | Jaws | Calibre | 2 | 11-13-2020 10:42 PM |
| remove unused CSS rules | rjwse@aol.com | Editor | 13 | 09-18-2019 09:39 AM |
| Remove unused CSS Rules | Divingduck | Editor | 2 | 06-21-2014 07:51 AM |