View Single Post
Old 07-25-2017, 04:46 PM   #12
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,737
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
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.

Last edited by Doitsu; 07-26-2017 at 02:23 AM.
Doitsu is offline   Reply With Quote