[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Image size with XSL?

Subject: Re: Image size with XSL?
From: "Max Zhaloba mzhaloba@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 18 Dec 2016 21:07:07 -0000
Re:  Image size with XSL?
We had a similar task on one of our projects. However there was not so 
many files, we also invoked an external utility to read the metadata. We 
used Image Magick (imagemagick.org).

You can iterate over image files and call identify.exe with "-format" 
option that contains XML tags:

<image>\n<file>%i</file>\n<width>%w</width>\n<height>%h</height>\n</image>

and redirect the standard output to file. Then as soon as you wrap the 
contents of that file into the pair of opening/closing tags it becomes a 
well-formed XML an you can read it from XSLT.  And since performance is 
a factor for you, it will be faster to use <xsl:key> for that purpose.

There's a handy installer of Image Magick for OS X at 
http://cactuslab.com/imagemagick, if you're on Mac.

- Max
(blog.xml.rocks <http://blog.xml.rocks>)

On 18.12.2016 9:54 PM, Mark Wilson mark@xxxxxxxxxxxx wrote:
> I have an XSL stylesheet driven by an XML data source that produces 
> about 5000 different pages, many with multiple images. I have been 
> adding by hand a placement-index to the XML data source that arranges 
> the images neatly, as with this page:
>     http://www.cpslib.org/amp/europa-themes.htm.
>
> I am now faced with adding a huge number of images to a page or pages 
> like this:
>     http://www.cpslib.org/flaws/flaws.htm
>
> I would like to add the placement-index to the XML data source 
> programmatically. Is there a way to obtain the height or width of a 
> jpeg image from the file itself (image.jpg, for instance) using XSLT? 
> Or, can someone suggest another way to do this programmatically?
>
> Feel free to wander around the website if you find it interesting.
>
> Thanks,
> Mark

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.