View Single Post
Old 10-24-2024, 08:46 AM   #533
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 80,207
Karma: 148951761
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by philja View Post
Which is essentially what I did. I hacked together a regex FIND:

<img\s+(alt="Image .+?")\s+(src="../Images/image\d+\.gif")\s+width="(\d+)%"\s*/>

[ this also worked <img\s+(alt="[^"]*")\s+(src="[^"]*")\s+width="(\d+)%"\s*/> ]

with a REPLACE:

<img class="w\3" \2 \1/>

[This put the alt entry at the end keeping it out of the way visually when checking images later.]

Since many of the images had width=50%, I started with an additional CSS class in the style sheet :

.w50 {height: auto;width: 50%}

and then did a find/replace one at a time. This was a little tedious but pretty quick. When I came to an image with a different width %, if I then decided it would be better to keep it at that width, I just created an additional CSS style entry.

Afterwards, I was curious to find out why all the image entries were not displayed as errors by the epubcheck plugin. So I redid the epub3 conversion and investigated. I also had a look at the log and saw that it had a line:

Code:
 "message" : "Error while parsing file: value of attribute \"width\" is invalid; must be an integer",
    "additionalLocations" : 50,
I think that if some indication of the total number of errors would be displayed by the epubcheck plugin, it would be helpful to those authors who don't know how to access the log.
You would solve the IMG problem by removing the width and replacing it with a class. Then all you would need to do is fix that one classes as needed. Plus, converting to ePub3 would work.
JSWolf is offline   Reply With Quote