You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cr...@apache.org on 2004/03/21 04:23:10 UTC
cvs commit: cocoon-2.1/src/webapp/samples/imagereader add.jpg dir2page.xsl fix.jpg remove.jpg update.jpg samples.xml sitemap.xmap
crossley 2004/03/20 19:23:10
Modified: src/webapp/samples components-samples.xml
src/webapp/samples/imagereader samples.xml sitemap.xmap
Added: src/webapp/samples/imagereader add.jpg dir2page.xsl fix.jpg
remove.jpg update.jpg
Log:
Add a sample for Image Directory Generator.
Revision Changes Path
1.6 +4 -1 cocoon-2.1/src/webapp/samples/components-samples.xml
Index: components-samples.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/components-samples.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- components-samples.xml 20 Mar 2004 12:43:40 -0000 1.5
+++ components-samples.xml 21 Mar 2004 03:23:10 -0000 1.6
@@ -40,6 +40,9 @@
<sample href="request.html" name="Request Page">
This example shows the usage of the RequestGenerator.
</sample>
+ <sample href="imagereader/list" name="Image Directory Generator">
+ Read a directory, process images and find their attributes.
+ </sample>
</group>
<group name="Transformers">
1.5 +14 -8 cocoon-2.1/src/webapp/samples/imagereader/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/imagereader/samples.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- samples.xml 20 Mar 2004 12:28:22 -0000 1.4
+++ samples.xml 21 Mar 2004 03:23:10 -0000 1.5
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<samples xmlns:xlink="http://www.w3.org/1999/xlink">
+<samples xmlns:xlink="http://www.w3.org/1999/xlink" name="ImageReader Samples">
<group name="Main examples page.">
<sample name="Back" href="..">to Cocoon examples main page</sample>
@@ -36,32 +36,38 @@
</group>
<group name="ImageReader - Grayscaling">
- <sample href="image-grayscale" name="Image grayscaled.">
+ <sample href="image-grayscale" name="Image grayscaled">
The image in gray.
</sample>
</group>
<group name="ImageReader - Color Scaling">
- <sample href="image-color-scale-2-1-1" name="Image tinted red.">
+ <sample href="image-color-scale-2-1-1" name="Image tinted red">
The values for the color red are doubled.
</sample>
- <sample href="image-color-scale-1-2-1" name="Image tinted green.">
+ <sample href="image-color-scale-1-2-1" name="Image tinted green">
The values for the color green are doubled.
</sample>
- <sample href="image-color-scale-1-1-2" name="Image tinted blue.">
+ <sample href="image-color-scale-1-1-2" name="Image tinted blue">
The values for the color blue are doubled.
</sample>
</group>
<group name="ImageReader - Color Offset">
- <sample href="image-color-offset-50-0-0" name="Image tinted red.">
+ <sample href="image-color-offset-50-0-0" name="Image tinted red">
The values for the color red are incremented by 50.
</sample>
- <sample href="image-color-offset-0-50-0" name="Image tinted green.">
+ <sample href="image-color-offset-0-50-0" name="Image tinted green">
The values for the color green are incremented by 50.
</sample>
- <sample href="image-color-offset-0-0-50" name="Image tinted blue.">
+ <sample href="image-color-offset-0-0-50" name="Image tinted blue">
The values for the color blue are incremented by 50.
+ </sample>
+ </group>
+
+ <group name="Image Directory Generator">
+ <sample href="list" name="imagedirectory">
+ Read a directory, process images and find their attributes.
</sample>
</group>
</samples>
1.6 +23 -2 cocoon-2.1/src/webapp/samples/imagereader/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/imagereader/sitemap.xmap,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sitemap.xmap 11 Mar 2004 16:25:50 -0000 1.5
+++ sitemap.xmap 21 Mar 2004 03:23:10 -0000 1.6
@@ -65,7 +65,28 @@
<map:parameter name="offsetBlue" value="{3}"/>
</map:read>
</map:match>
+
+ <map:match pattern="list">
+ <map:generate type="imagedirectory" src=".">
+ <map:parameter name="dateFormat" value="yyyy-MM-dd hh:mm" />
+ <map:parameter name="depth" value="1" />
+ <map:parameter name="include" value=".*\.jpg" />
+ </map:generate>
+ <map:transform src="dir2page.xsl" />
+ <map:serialize type="html"/>
+ </map:match>
+
+ <map:match pattern="full-*">
+ <map:read src="{1}.jpg" mime-type="image/jpeg"/>
+ </map:match>
+
+ <map:match pattern="scale-*-*-*">
+ <map:read type="image" src="{3}.jpg" mime-type="image/jpeg">
+ <map:parameter name="width" value="{1}"/>
+ <map:parameter name="height" value="{2}"/>
+ </map:read>
+ </map:match>
+
</map:pipeline>
</map:pipelines>
</map:sitemap>
-
1.1 cocoon-2.1/src/webapp/samples/imagereader/add.jpg
<<Binary file>>
1.1 cocoon-2.1/src/webapp/samples/imagereader/dir2page.xsl
Index: dir2page.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dir="http://apache.org/cocoon/directory/2.0">
<xsl:template match="/">
<html><head><title>Image Directory Generator demonstration</title></head>
<body>
<h1>Image Directory Generator demonstration</h1>
<xsl:apply-templates/>
<p>
See other <a href=".">image reader</a> samples.
</p>
<p>
See documentation for
<a href="../../docs/userdocs/generators/imagedirectory-generator.html">Image
Directory Generator</a> and
<a href="../../docs/userdocs/readers/image-reader.html">Image Reader</a>
</p>
</body></html>
</xsl:template>
<xsl:template match="dir:directory">
<table border="1" cellpadding="3" cellspacing="3">
<tr>
<th>Image</th>
<th>Name</th>
<th>Width</th>
<th>Height</th>
<th colspan="2">Scale Size</th>
</tr>
<xsl:apply-templates select="dir:file|dir:directory"/>
</table>
</xsl:template>
<xsl:template match="dir:file">
<xsl:variable name="basename" select="substring-before(@name,'.jpg')"/>
<tr>
<td valign="top">
<img src="full-{$basename}" alt="{@name} (full size)"
title="{@name} (full size)"
width="{@width}" height="{@height}"
/>
</td>
<td valign="top"><xsl:value-of select="$basename"/></td>
<td valign="top"><xsl:value-of select="@width"/></td>
<td valign="top"><xsl:value-of select="@height"/></td>
<td valign="top">
<a href="scale-{@width*2}-{@height*2}-{$basename}"
title="{@name} (double size)">2x</a>
</td>
<td valign="top">
<a href="scale-{@width*3}-{@height*3}-{$basename}"
title="{@name} (triple size)">3x</a>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1 cocoon-2.1/src/webapp/samples/imagereader/fix.jpg
<<Binary file>>
1.1 cocoon-2.1/src/webapp/samples/imagereader/remove.jpg
<<Binary file>>
1.1 cocoon-2.1/src/webapp/samples/imagereader/update.jpg
<<Binary file>>