Handle floats as img widths

This commit is contained in:
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 # TODO: consider inlined CSS styles as well as width & height attribs
images = tree.xpath("//img[@src][number(@width)>10][number(@height)>10]") images = tree.xpath("//img[@src][number(@width)>10][number(@height)>10]")
images = sorted(images, key=lambda i: ( 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: if not images:
images = tree.xpath("//img[@src]") images = tree.xpath("//img[@src]")