E-book viewer: Workaround to display images that have been embedded in svg containers. Fixes #4716 (Unable to view ePUB cover images in calibre viewer)

This commit is contained in:
Kovid Goyal 2010-01-28 19:18:00 -07:00
parent 508b60712d
commit d54c1a867e

View File

@ -20,4 +20,20 @@ function setup_image_scaling_handlers() {
}); });
} }
function extract_svged_images() {
$("svg").each(function() {
var children = $(this).children("img");
if (children.length == 1) {
var img = $(children[0]);
var href = img.attr('xlink:href');
if (href != undefined) {
$(this).replaceWith('<div style="text-align:center; margin: 0; padding: 0"><img style="height: 98%" alt="SVG Image" src="' + href +'"></img></div>');
}
}
});
}
$(document).ready(function() {
extract_svged_images();
});