Handle floats as img widths

pull/872/head
Erik Johnston 2016-06-15 16:58:05 +01:00
parent a60169ea09
commit 1e9026e484
1 changed files with 1 additions and 1 deletions

View File

@ -280,7 +280,7 @@ class PreviewUrlResource(Resource):
# TODO: consider inlined CSS styles as well as width & height attribs
images = tree.xpath("//img[@src][number(@width)>10][number(@height)>10]")
images = sorted(images, key=lambda i: (
-1 * int(i.attrib['width']) * int(i.attrib['height'])
-1 * float(i.attrib['width']) * float(i.attrib['height'])
))
if not images:
images = tree.xpath("//img[@src]")