[Pcsclite-git-commit] [website] 12/12: Add image dimensions to speed up HTML display

Ludovic Rousseau rousseau at moszumanska.debian.org
Sat May 9 16:21:06 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 4f3f085075977b445462ff72d4251301f54c2200
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sat May 9 18:07:05 2015 +0200

    Add image dimensions to speed up HTML display
    
    The supported.html, shouldwork.html, unsupported.html and disabled.html
    webpages now include the dimensions of the reader images.
    
    This helps the browser to correctly display the web page without
    updating the dimensions (and redisplay) each time an image is loaded and
    displayed.
---
 matrix.py        | 7 ++++++-
 webpage.template | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/matrix.py b/matrix.py
index 01da1b0..11b84db 100755
--- a/matrix.py
+++ b/matrix.py
@@ -28,6 +28,7 @@ import ConfigParser
 import templayer
 import time
 import re
+from PIL import Image
 
 #pp = pprint.PrettyPrinter(indent=4)
 
@@ -429,12 +430,16 @@ def generate_page(section, title, comment, readers):
 
         # for each reader
         for reader in sorted(manufacturer_readers[manufacturer]):
+            image = "img/" + readers[reader].get('image', "no_image.png")
+            im = Image.open("ccid/" + image)
+            resolution = "width:%spx;height:%dpx" % im.size
             note_layer = main_layer.open_layer('reader',
                 manufacturer=manufacturer,
                 product=readers[reader]['iProduct'],
                 idVendor=readers[reader]['idVendor'],
                 idProduct=readers[reader]['idProduct'],
-                image="img/" + readers[reader].get('image', "no_image.png"))
+                image=image,
+                style=resolution)
 
             if reader[:-1].endswith("_i"):
                 reader_txt = reader[:-3]
diff --git a/webpage.template b/webpage.template
index af93adc..8338185 100644
--- a/webpage.template
+++ b/webpage.template
@@ -52,7 +52,7 @@
         <li>
             <a name="%idVendor%%idProduct%"></a>
             %manufacturer% <a href="#%idVendor%%idProduct%">%product%</a>
-          <p><img src="%image%" alt="%manufacturer% %product%"></p>
+          <p><img src="%image%" alt="%manufacturer% %product%" style="%style%"></p>
           %contents%
       </li>
     </ul>

-- 
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