title: Detect image orientation (landscape, portrait) for proper printing of a XHTML report
body: <p>I'm writing a XSL file that converts XML to a XHTML report. This XML contains image IDs that are paper scans (US Letter) which can be of various sizes and can also be in landscape or portrait orientation. I'm looking for a way to print them maximized to a page of paper (with a custom header). So I can either rotate the image to fit it to a portrait page or tell the printer to consider this page in landscape mode. Something that would look like : </p>
  
  <pre><code>&lt;img id="portrait" src="http://1.2.3.4/img/getImage.cgi?ID=1" /&gt;
  &lt;img id="landscape" src="http://1.2.3.4/img/getImage.cgi?ID=2" /&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;img src="http://1.2.3.4/img/getImage.cgi?ID=1" /&gt;
  &lt;div id="landscape"&gt;
      &lt;img src="http://1.2.3.4/img/getImage.cgi?ID=2" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What I considered, and why it does not work : </p>
  
  <ul>
  <li>I know XSL can't do it since it only links the image and does not load them so it is not aware of their properties.</li>
  <li>HTML can not do it either since it is rendered by the XSLT transformation and the code can not update itself sadly ;)</li>
  <li>I don't think it is the purpose of CSS either. And JavaScript probably won't work well with Flying Saucer (PDF generation) although I'm willing to try but haven't found a clear way.</li>
  <li>I do not have access to the CGI scripts that retrieve the images in the DB. So I can not modify them.</li>
  </ul>
  
  <p>What I do not have considered : 
   - Evaluate the problem the other way around, using another tool (e.g. perl script) to read the XML file and produce the proper HTML report. However this would be different technology which I'd like to avoid if possible.</p>
  
  <p>What do you think about this, do some of you have experience with this and any hint or suggestion on how to solve this problem ?</p>
  
  <p>As always, thank you so much for your time.</p>
  
  <p>Best regards,</p>
  
  <p>Manny</p>