Quote:
Originally Posted by KevinH
When I get a free moment tomorrow, I will see if there are any other special cases that make any sense to handle as well, as there still should be cases when image height is larger than image width but less than screen height that should be handled scaled appropriately too.
|
BTW, there's one more thing to consider.
roger64's method will only work for epub2 books, because epubcheck will flag
img width percentage values in epub3 books with the following error message:
ERROR(RSC-005): Error while parsing file 'value of attribute "width" is invalid; must be an integer'.
Apparently, in HTML5 files, image scaling must be done via CSS. For example, via
id or
class attributes.
I.e., it might be better to generate custom
class or
id based styles for each unique image, because this method will work for epub2 and epub3 books. (Of course, the plugin would also have to remove any existing
img width/height attributes.)
EDIT: I had assumed that roger64 used a width attribute with a percentage value. I re-read the thread and found out that he uses inline styles. These inline styles will of course not be flagged by epubcheck.