You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@sergeant.org on 2006/08/04 18:38:03 UTC

[SVN] [37] Image gallery (and bug fixes required to make that work)

Revision: 37
Author:   matt
Date:     2006-08-04 16:37:37 +0000 (Fri, 04 Aug 2006)

Log Message:
-----------
Image gallery (and bug fixes required to make that work)

Modified Paths:
--------------
    trunk/etc/axkit.conf
    trunk/lib/AxKit2/Processor.pm
    trunk/plugins/dir_to_xml
    trunk/plugins/uri_to_file

Added Paths:
-----------
    trunk/demo/gallery/
    trunk/demo/gallery/Photo 1.jpg
    trunk/demo/gallery/Photo 2.jpg
    trunk/demo/gallery/Photo 4.jpg
    trunk/demo/gallery/Photo 6.jpg
    trunk/demo/gallery/stylesheets/
    trunk/demo/gallery/stylesheets/breadcrumb.xsl
    trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl
    trunk/demo/gallery/stylesheets/identity.xsl
    trunk/demo/gallery/stylesheets/imagesheet2html.xsl
    trunk/demo/gallery/stylesheets/mergeimageinfo.xsl
    trunk/demo/gallery/stylesheets/proofsheet2html.xsl
    trunk/demo/gallery/stylesheets/proofsheet2rss.xsl
    trunk/demo/gallery/stylesheets/sortfilelist.xsl
    trunk/demo/icons/
    trunk/demo/icons/folder.gif
    trunk/demo/stylesheets/
    trunk/demo/stylesheets/default.css
    trunk/plugins/demo/gallery

Added: trunk/demo/gallery/Photo 1.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/demo/gallery/Photo 1.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/demo/gallery/Photo 2.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/demo/gallery/Photo 2.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/demo/gallery/Photo 4.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/demo/gallery/Photo 4.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/demo/gallery/Photo 6.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/demo/gallery/Photo 6.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/demo/gallery/stylesheets/breadcrumb.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/breadcrumb.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/breadcrumb.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!-- 
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: breadcrumb.xsl,v 1.2 2004/02/26 11:58:50 nik Exp $
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:dc="http://dublincore.org/documents/2003/02/04/dces/"
+  xmlns:exif="http://impressive.net/people/gerald/2001/exif#"
+  xmlns:foaf="http://xmlns.com/foaf/0.1/"
+  xmlns:aag="http://search.cpan.org/~nikc/AxKit-App-Gallery/xml#"
+  xmlns:img="http://www.cpan.org/authors/id/G/GA/GAAS/#"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:lookup="lookup.uri"
+  version="1.0">
+
+  <xsl:template name="breadcrumb">
+    <xsl:param name="nodes"/>
+
+    <div class="breadcrumbs"><a href="/">root</a> :
+    <xsl:for-each select="$nodes">
+      <xsl:choose>
+        <xsl:when test="position() != last()">
+          <a>
+            <xsl:attribute name="href">
+              <xsl:for-each select="./preceding-sibling::component">
+                <xsl:text>/</xsl:text><xsl:value-of select="u"/>
+              </xsl:for-each>
+              <xsl:text>/</xsl:text><xsl:value-of select="u"/>/<xsl:text/>
+            </xsl:attribute>
+            <xsl:value-of select="u"/>
+          </a> :
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="u"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </div>
+</xsl:template>
+</xsl:stylesheet>

Added: trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!-- 
+
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: filelist2proofsheet.xsl,v 1.1.1.1 2003/03/29 17:11:49 nik Exp $
+
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:f="http://axkit.org/2002/filelist"
+  exclude-result-prefixes="f"
+  version="1.0">
+
+  <xsl:template match="/">
+    <proofsheet>
+
+    <config>
+      <!-- Space for information about the configuration used to build this
+	   proofsheet -->
+    </config>
+
+    <albums>
+      <xsl:apply-templates select="//f:directory"/>
+    </albums>
+
+    <images>
+      <xsl:apply-templates select="//f:file"/>
+    </images>
+    </proofsheet>
+  </xsl:template>
+
+  <xsl:template match="f:directory">
+    <album>
+      <name><xsl:value-of select="."/></name>
+      <ctime><xsl:value-of select="@ctime"/></ctime>
+    </album>
+  </xsl:template>
+
+  <xsl:template match="f:file">
+    <xsl:choose>
+      <xsl:when test="contains(text(), '.jpg') or contains(text(), '.JPG')">
+    <image>
+      <filename><xsl:value-of select="."/></filename>
+      <filesize><xsl:value-of select="@size"/></filesize>
+      <modified><xsl:value-of select="@mtime"/></modified>
+      <navigation>
+        <xsl:if test="./preceding-sibling::f:file">
+          <prev><xsl:value-of select="preceding-sibling::f:file[1]"/></prev>
+        </xsl:if>
+        <xsl:if test="./following-sibling::f:file">
+          <next><xsl:value-of select="following-sibling::f:file[1]"/></next>
+        </xsl:if>
+      </navigation>
+    </image>
+      </xsl:when>
+      <xsl:otherwise>
+    <file>
+      <filename><xsl:value-of select="."/></filename>
+      <filesize><xsl:value-of select="@size"/></filesize>
+      <modified><xsl:value-of select="@mtime"/></modified>
+      <navigation>
+        <xsl:if test="./preceding-sibling::f:file">
+          <prev><xsl:value-of select="preceding-sibling::f:file[1]"/></prev>
+        </xsl:if>
+        <xsl:if test="./following-sibling::f:file">
+          <next><xsl:value-of select="following-sibling::f:file[1]"/></next>
+        </xsl:if>
+      </navigation>
+    </file>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>

Added: trunk/demo/gallery/stylesheets/identity.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/identity.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/identity.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: identity.xsl,v 1.1 2003/10/19 20:31:31 nik Exp $
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  version="1.0">
+
+  <xsl:template match="*|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Added: trunk/demo/gallery/stylesheets/imagesheet2html.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/imagesheet2html.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/imagesheet2html.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!-- 
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: imagesheet2html.xsl,v 1.11 2004/02/26 11:48:51 nik Exp $
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:dc="http://dublincore.org/documents/2003/02/04/dces/"
+  xmlns:exif="http://impressive.net/people/gerald/2001/exif#"
+  xmlns:foaf="http://xmlns.com/foaf/0.1/"
+  xmlns:aag="http://search.cpan.org/~nikc/AxKit-App-Gallery/xml#"
+  xmlns:img="http://www.cpan.org/authors/id/G/GA/GAAS/#"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:filelist="http://axkit.org/2002/filelist"
+  xmlns:lookup="lookup.uri"
+  xmlns:exslt="http://exslt.org/common"
+  version="1.0">
+
+  <xsl:include href="breadcrumb.xsl"/>
+
+  <xsl:variable name="sorted_filelist">
+    <xsl:apply-templates mode="filelist" select="document(/imagesheet/image/uri/path/e/text())/filelist:filelist/filelist:file[contains(text(), '.jpg') or contains(text(), '.JPG')]">
+      <xsl:sort select="."/>
+    </xsl:apply-templates>
+  </xsl:variable>
+
+  <xsl:variable name="thisURI">
+    <xsl:for-each select="/imagesheet/image/uri/component">
+      <xsl:text>/</xsl:text>
+      <xsl:value-of select="u"/>
+    </xsl:for-each>
+    <xsl:text>?format=html</xsl:text>
+  </xsl:variable>
+
+  <xsl:variable name="currentSize" select="/imagesheet/config/perl-vars/GallerySizes/size[@type='default']"/>
+
+  <!-- Map EXIF field values back to useful names.  Some day this will be
+       split out in to separate files, chosen at run time, to make l10n
+       that much easier.  But not today... -->
+  <lookup:flash value="0">Flash did not fire</lookup:flash>
+  <lookup:flash value="1">Flash fired</lookup:flash>
+  <lookup:flash value="5">Strobe return light not detected</lookup:flash>
+  <lookup:flash value="7">Strobe return light detected</lookup:flash>
+  <lookup:flash value="9">Flash fired</lookup:flash> <!-- XXX DImage 7i value -->
+
+  <xsl:template match="/">
+  <xsl:param name="filename" select="/imagesheet/image/filename/text()"/>
+
+    <html>
+      <head>
+        <title>Imagesheet for <xsl:value-of select="$filename"/></title>
+	<link rel="stylesheet" type="text/css" href="/stylesheets/default.css"/>
+      </head>
+
+      <body>
+	<div id="header">
+        <xsl:call-template name="breadcrumb">
+          <xsl:with-param name="nodes" select="/imagesheet/image/uri/component"/>
+        </xsl:call-template>
+	</div>
+        
+	<div id="content">
+	<div class="picture">
+        <p align="center"><img>
+	  <xsl:attribute name="src"><xsl:value-of select="/imagesheet/image/filename"/>?format=raw;size=<xsl:value-of select="$currentSize"/></xsl:attribute>
+          <xsl:choose>
+            <xsl:when test="$currentSize='full'">
+              <xsl:attribute name="height"><xsl:value-of select="//rdf:Description/exif:ImageHeight"/></xsl:attribute>
+              <xsl:attribute name="width"><xsl:value-of select="//rdf:Description/exif:ImageWidth"/></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="height"><xsl:value-of select="//foaf:thumbnail[rdf:Description/aag:size = ancestor::image/size]/rdf:Description/img:height"/></xsl:attribute>
+              <xsl:attribute name="width"><xsl:value-of select="//foaf:thumbnail[rdf:Description/aag:size = ancestor::image/size]/rdf:Description/img:width"/></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose></img></p>
+	</div>
+   
+	<p align="center">Sizes: 
+	  <xsl:for-each select="/imagesheet/config/perl-vars/GallerySizes/size">
+
+	    <xsl:if test="not(@type = 'thumb')">
+	      [ <xsl:choose>
+                  <xsl:when test=". = /imagesheet/image/size">
+                    <xsl:value-of select="."/>
+                  </xsl:when>
+                  <xsl:when test=". = 'full'">
+                    <a href="{/imagesheet/image/filename}?format=raw;size=full">full</a>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <a><xsl:attribute name="href"><xsl:value-of select="concat($thisURI, ';size=', .)"/></xsl:attribute><xsl:value-of select="."/></a>
+                  </xsl:otherwise>
+                </xsl:choose> ]
+	    </xsl:if>
+	  </xsl:for-each>
+	</p>
+
+	<table class="bottom" align="center" width="*">
+	<tr>
+	<td align="left" valign="top">
+          <xsl:if test="exslt:node-set($sorted_filelist)/filelist:file[following-sibling::filelist:file/text() = $filename][last()]">
+	  <a href="{exslt:node-set($sorted_filelist)/filelist:file[following-sibling::filelist:file/text() = $filename][last()]}?format=html;size={$currentSize}"><img src="{exslt:node-set($sorted_filelist)/filelist:file[following-sibling::filelist:file/text() = $filename][last()]}?format=raw;size=thumb"/></a>
+          </xsl:if>
+        </td>
+	<td valign="top">
+	<table class="info" align="center">
+          <xsl:if test="//exif:DateTimeOriginal">
+            <tr>
+              <th align="right">Picture Taken:</th>
+              <td><xsl:value-of select="//exif:DateTimeOriginal"/></td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="//exif:ExposureTime">
+            <!-- Get the focal length, so it can be formatted later -->
+            <xsl:variable name="FocalLength" select="//exif:FocalLength"/>
+            <!-- Old way of getting this...
+              <xsl:call-template name="norm-frac">
+                <xsl:with-param name="str" select="
+              </xsl:call-template>
+            </xsl:variable>
+            -->
+
+            <tr>
+              <th align="right">Exposure:</th>
+               <td>
+                 <!-- Format the focal length -->
+                 <xsl:value-of select="$FocalLength"/> at
+                 <!-- Use the fractional exposure time if the denominator is not 1, 
+                      otherwise use the numerator -->
+                 <xsl:choose>
+                   <xsl:when test="substring-after(//exif:ExposureTime, '/') = 1">
+                     <xsl:value-of select="substring-before(//exif:ExposureTime, '/')"/>
+                   </xsl:when>
+                   <xsl:otherwise>
+                     <xsl:value-of select="//exif:ExposureTime"/>
+                   </xsl:otherwise>
+                 </xsl:choose> sec<xsl:text/> 
+                 <!-- Convert the F number to a decimal -->
+                 <xsl:text>, </xsl:text>F<xsl:value-of select="//exif:FNumber"/>
+                 <!-- The exposure program ('program', 'manual', etc) -->
+		 <xsl:if test="//exif:ExposureProgram">
+                   <xsl:text>, </xsl:text>
+                   <xsl:value-of select="//exif:ExposureProgram"/>
+                 </xsl:if>
+               </td>
+             </tr>
+           </xsl:if>
+
+           <xsl:if test="//exif:Flash">
+             <tr>
+               <th align="right">Flash?</th>
+               <xsl:choose>
+                 <xsl:when test="document('')/xsl:stylesheet/lookup:flash[@value=//exif:Flash]">
+                   <td><xsl:value-of select="document('')/xsl:stylesheet/lookup:flash[@value=//exif:Flash]"/></td>
+                 </xsl:when>
+                 <!-- If we don't recognise the value, use the Flash value as
+                      is.  The Canon EOS10D puts in a text string, rather 
+                      than a value -->
+                 <xsl:otherwise>
+                   <td><xsl:value-of select="//exif:Flash"/></td>
+                 </xsl:otherwise>
+               </xsl:choose>
+             </tr>
+           </xsl:if>
+
+          <xsl:choose>
+            <xsl:when test="//exif:ISO1">
+            <tr>
+              <th align="right">ISO:</th>
+              <td><xsl:value-of select="//exif:ISO1"/></td>
+            </tr>
+            </xsl:when>
+            <xsl:when test="//exif:ISO">
+            <tr>
+              <th align="right">ISO:</th>
+              <td><xsl:value-of select="//exif:ISO"/></td>
+            </tr>
+            </xsl:when>
+          </xsl:choose>
+
+          <xsl:if test="//exif:ImageWidth and //exif:ImageHeight and //image/filesize">
+            <tr>
+              <th align="right">Full Size:</th>
+              <td><xsl:value-of select="//exif:ImageWidth"/> x <xsl:value-of select="//exif:ImageHeight"/>, <xsl:value-of select="format-number((//image/filesize div 1024), '#,##0')"/>K</td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="//exif:Make">
+            <tr>
+              <th align="right">Camera:</th>
+              <td><xsl:value-of select="//exif:Make"/>, <xsl:value-of select="//exif:Model"/></td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="//exif:Lens">
+            <tr>
+              <th align="right">Lens:</th>
+              <td><xsl:value-of select="//exif:Lens"/></td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="//exif:AFPoint">
+            <tr>
+              <th align="right">Focus Point:</th>
+              <td><xsl:value-of select="//exif:AFPoint"/></td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="//exif:WhiteBalance">
+            <tr>
+              <th align="right">White Balance:</th>
+              <td><xsl:value-of select="//exif:WhiteBalance"/></td>
+            </tr>
+          </xsl:if>
+
+	</table>
+	</td>
+	<td align="right" valign="top">
+          <xsl:if test="exslt:node-set($sorted_filelist)/filelist:file[preceding-sibling::filelist:file/text() = $filename]">
+	  <a href="{exslt:node-set($sorted_filelist)/filelist:file[preceding-sibling::filelist:file/text() = $filename]}?format=html;size={$currentSize}"><img src="{exslt:node-set($sorted_filelist)/filelist:file[preceding-sibling::filelist:file/text() = $filename]}?format=raw;size=thumb"/></a>
+          </xsl:if>
+	</td>
+	</tr>
+	</table>
+	</div>
+	
+	<div id="footer">
+        <div class="createdwith">Created with <a href="http://search.cpan.org/~nikc/AxKit-App-Gallery/">AxKit::App::Gallery</a></div>
+	</div>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template name="norm-frac">
+    <xsl:param name="str"/>
+
+    <xsl:variable name="num" select="substring-before($str, '/')"/>
+    <xsl:variable name="den" select="substring-after($str, '/')"/>
+
+    <xsl:choose>
+      <xsl:when test="$den = 1">
+        <xsl:value-of select="$num"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$num div $den"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template mode="nextprev" match="*">
+    <xsl:param name="filename"/>
+    NextPrev template applied <xsl:value-of select="following-sibling::filelist:file[text() = $filename][last()]"/>
+    <!-- <xsl:value-of select="[following-sibling::filelist:file/text() = $filename][last()]"/> -->
+  </xsl:template>
+
+  <xsl:template mode="filelist" match="*">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="filelist" select="*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+</xsl:stylesheet>

Added: trunk/demo/gallery/stylesheets/mergeimageinfo.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/mergeimageinfo.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/mergeimageinfo.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: mergeimageinfo.xsl,v 1.3 2003/10/19 20:11:34 nik Exp $
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  version="1.0">
+
+  <xsl:variable name="cachedir" select="//config/perl-vars/var[@name='GalleryCache']"/>
+
+  <!-- XXX Assumes that the only thing that might need URI escaping is 
+       the full path to the file (which might contain things like spaces).
+       Will fail to do the right thing if the cache root or the filename
+       contains spaces. -->
+  <xsl:template match="image">
+    <xsl:variable name="imageinfo">
+      <xsl:text>file://</xsl:text>
+      <xsl:value-of select="$cachedir"/>
+      <xsl:call-template name="url-encode">
+        <xsl:with-param name="str" select="dirpath"/>
+      </xsl:call-template>
+      <xsl:text>/</xsl:text>
+      <xsl:value-of select="filename"/>
+      <xsl:text>/imageinfo.rdf</xsl:text>
+    </xsl:variable>
+    
+    <image>
+      <xsl:copy-of select="*|@*|node()"/>
+      <xsl:copy-of select="document($imageinfo)"/>
+    </image>
+  </xsl:template>
+
+  <xsl:template match="*|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <!-- Following taken from http://skew.org/xml/stylesheets/url-encode/ -->
+
+  <!-- ISO-8859-1 based URL-encoding demo
+       Written by Mike J. Brown, mike@skew.org.
+       Updated 2002-05-20.
+
+       No license; use freely, but credit me if reproducing in print.
+
+       Also see http://skew.org/xml/misc/URI-i18n/ for a discussion of
+       non-ASCII characters in URIs.
+  -->
+
+  <!-- Characters we'll support.
+       We could add control chars 0-31 and 127-159, but we won't. -->
+  <xsl:variable name="ascii"> !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable>
+  <xsl:variable name="latin1">&#160;&#161;&#162;&#163;&#164;&#165;&#166;&#167;&#168;&#169;&#170;&#171;&#172;&#173;&#174;&#175;&#176;&#177;&#178;&#179;&#180;&#181;&#182;&#183;&#184;&#185;&#186;&#187;&#188;&#189;&#190;&#191;&#192;&#193;&#194;&#195;&#196;&#197;&#198;&#199;&#200;&#201;&#202;&#203;&#204;&#205;&#206;&#207;&#208;&#209;&#210;&#211;&#212;&#213;&#214;&#215;&#216;&#217;&#218;&#219;&#220;&#221;&#222;&#223;&#224;&#225;&#226;&#227;&#228;&#229;&#230;&#231;&#232;&#233;&#234;&#235;&#236;&#237;&#238;&#239;&#240;&#241;&#242;&#243;&#244;&#245;&#246;&#247;&#248;&#249;&#250;&#251;&#252;&#253;&#254;&#255;</xsl:variable>
+
+  <!-- Characters that usually don't need to be escaped -->
+  <xsl:variable name="safe">!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable>
+
+  <xsl:variable name="hex" >0123456789ABCDEF</xsl:variable>
+
+  <xsl:template name="url-encode">
+    <xsl:param name="str"/>   
+    <xsl:if test="$str">
+      <xsl:variable name="first-char" select="substring($str,1,1)"/>
+      <xsl:choose>
+        <xsl:when test="contains($safe,$first-char)">
+          <xsl:value-of select="$first-char"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:variable name="codepoint">
+            <xsl:choose>
+              <xsl:when test="contains($ascii,$first-char)">
+                <xsl:value-of select="string-length(substring-before($ascii,$first-char)) + 32"/>
+              </xsl:when>
+              <xsl:when test="contains($latin1,$first-char)">
+                <xsl:value-of select="string-length(substring-before($latin1,$first-char)) + 160"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:message terminate="no">Warning: string contains a character that is out of range! Substituting "?".</xsl:message>
+                <xsl:text>63</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+        <xsl:variable name="hex-digit1" select="substring($hex,floor($codepoint div 16) + 1,1)"/>
+        <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
+        <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="string-length($str) &gt; 1">
+        <xsl:call-template name="url-encode">
+          <xsl:with-param name="str" select="substring($str,2)"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>

Added: trunk/demo/gallery/stylesheets/proofsheet2html.xsl
===================================================================
--- trunk/demo/gallery/stylesheets/proofsheet2html.xsl	2006-08-03 15:49:07 UTC (rev 36)
+++ trunk/demo/gallery/stylesheets/proofsheet2html.xsl	2006-08-04 16:37:37 UTC (rev 37)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+Copyright (c) 2003 Nik Clayton
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+$Id: proofsheet2html.xsl,v 1.7 2004/02/26 11:58:50 nik Exp $
+-->
+ 
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:exif="http://impressive.net/people/gerald/2001/exif#"
+  xmlns:foaf="http://xmlns.com/foaf/0.1/"
+  xmlns:aag="http://search.cpan.org/~nikc/AxKit-App-Gallery/xml#"

@@ Diff output truncated at 30000 characters. @@


Re: [SVN] [37] Image gallery (and bug fixes required to make that work)

Posted by Matt Sergeant <ma...@sergeant.org>.
It looks exactly like http://home.sergeant.org/

(except it probably runs faster :-)

On 6-Aug-06, at 9:00 PM, S. Woodside wrote:

> Is there a live example of this running somewhere? I'd like to look  
> at it without having to install AxKit2...
>
> (selfish I know)
>
> --simon
>
> On Aug 4, 2006, at 12:38 PM, matt@sergeant.org wrote:
>
>> Revision: 37
>> Author:   matt
>> Date:     2006-08-04 16:37:37 +0000 (Fri, 04 Aug 2006)
>>
>> Log Message:
>> -----------
>> Image gallery (and bug fixes required to make that work)
>>
>> Modified Paths:
>> --------------
>>     trunk/etc/axkit.conf
>>     trunk/lib/AxKit2/Processor.pm
>>     trunk/plugins/dir_to_xml
>>     trunk/plugins/uri_to_file
>>
>> Added Paths:
>> -----------
>>     trunk/demo/gallery/
>>     trunk/demo/gallery/Photo 1.jpg
>>     trunk/demo/gallery/Photo 2.jpg
>>     trunk/demo/gallery/Photo 4.jpg
>>     trunk/demo/gallery/Photo 6.jpg
>>     trunk/demo/gallery/stylesheets/
>>     trunk/demo/gallery/stylesheets/breadcrumb.xsl
>>     trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl
>>     trunk/demo/gallery/stylesheets/identity.xsl
>>     trunk/demo/gallery/stylesheets/imagesheet2html.xsl
>>     trunk/demo/gallery/stylesheets/mergeimageinfo.xsl
>>     trunk/demo/gallery/stylesheets/proofsheet2html.xsl
>>     trunk/demo/gallery/stylesheets/proofsheet2rss.xsl
>>     trunk/demo/gallery/stylesheets/sortfilelist.xsl
>>     trunk/demo/icons/
>>     trunk/demo/icons/folder.gif
>>     trunk/demo/stylesheets/
>>     trunk/demo/stylesheets/default.css
>>     trunk/plugins/demo/gallery
>


Re: [SVN] [37] Image gallery (and bug fixes required to make that work)

Posted by "S. Woodside" <sb...@yahoo.com>.
Is there a live example of this running somewhere? I'd like to look  
at it without having to install AxKit2...

(selfish I know)

--simon

On Aug 4, 2006, at 12:38 PM, matt@sergeant.org wrote:

> Revision: 37
> Author:   matt
> Date:     2006-08-04 16:37:37 +0000 (Fri, 04 Aug 2006)
>
> Log Message:
> -----------
> Image gallery (and bug fixes required to make that work)
>
> Modified Paths:
> --------------
>     trunk/etc/axkit.conf
>     trunk/lib/AxKit2/Processor.pm
>     trunk/plugins/dir_to_xml
>     trunk/plugins/uri_to_file
>
> Added Paths:
> -----------
>     trunk/demo/gallery/
>     trunk/demo/gallery/Photo 1.jpg
>     trunk/demo/gallery/Photo 2.jpg
>     trunk/demo/gallery/Photo 4.jpg
>     trunk/demo/gallery/Photo 6.jpg
>     trunk/demo/gallery/stylesheets/
>     trunk/demo/gallery/stylesheets/breadcrumb.xsl
>     trunk/demo/gallery/stylesheets/filelist2proofsheet.xsl
>     trunk/demo/gallery/stylesheets/identity.xsl
>     trunk/demo/gallery/stylesheets/imagesheet2html.xsl
>     trunk/demo/gallery/stylesheets/mergeimageinfo.xsl
>     trunk/demo/gallery/stylesheets/proofsheet2html.xsl
>     trunk/demo/gallery/stylesheets/proofsheet2rss.xsl
>     trunk/demo/gallery/stylesheets/sortfilelist.xsl
>     trunk/demo/icons/
>     trunk/demo/icons/folder.gif
>     trunk/demo/stylesheets/
>     trunk/demo/stylesheets/default.css
>     trunk/plugins/demo/gallery