[Pcsclite-git-commit] [website] 05/06: matrix.py: add the images size in the tables
Ludovic Rousseau
rousseau at moszumanska.debian.org
Wed Jun 10 15:43:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository website.
commit be9da4c8658df4eecc3218cfc13cebdb052cc905
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Wed Jun 10 17:31:53 2015 +0200
matrix.py: add the images size in the tables
Use the complete image size (not just the height in the HTML tables.
This should help the browser to display the page.
---
matrix.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/matrix.py b/matrix.py
index aaceea4..bf36b44 100755
--- a/matrix.py
+++ b/matrix.py
@@ -421,7 +421,16 @@ def add_line(file_desc, num, reader, fields):
(reader['section'], reader['idVendor'],
reader['idProduct'], reader[field]))
elif field == 'image':
- file_desc.write('<td><img src="%s" height="100" alt="image"></td>' % ("img/" + reader.get('image', "no_image.png")))
+ # the image has a fixed height of 100px
+ image = "img/" + reader.get('image', "no_image.png")
+ im = Image.open("ccid/" + image)
+ (x, y) = im.size
+ fixed_height = 100
+ x = x * fixed_height / y
+ y = fixed_height
+ resolution = "width:%dpx;height:%dpx" % (x, y)
+
+ file_desc.write('<td><img src="%s" style="%s" alt="image"></td>' % (image, resolution))
elif field == 'features':
file_desc.write("<td>%s</td>" % ", ".join(reader[field]))
else:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/website.git
More information about the Pcsclite-cvs-commit
mailing list