ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josep del Río <josep....@uworks.net>
Subject RE: Photo Album website generation using ANT
Date Tue, 27 Jul 2004 19:38:40 GMT
I made a pure ant screenshot organized little ago, but I think it's too
complicated for your needs:

---- main task ----
		<fileset dir="${productsFolder}/${productRef}/screens"
id="screenshotsFiles">
			<include name="*.jpg"/>
			<include name="*.gif"/>
		</fileset> 
		<pathconvert pathsep="," property="screenshotsRefs"
refid="screenshotsFiles">
			<map
from="${rootDir}\${productsFolder}\${productRef}\screens\" to=""/>
		</pathconvert>
				
		<!-- Count screens -->
		<count param="screenshotsRefs"
outputProperty="totalScreens"/>

		<!-- Parse screens -->
		<propertyfile file="${tempFolder}/count.properties"
comment="Counter">
			<entry key="totalScreens"
value="${totalScreens}"/>
			<entry key="screenNum" value="1"/>
		</propertyfile>
		<foreach list="${screenshotsRefs}" param="screenshotRef"
target="makeScreenshot"/>



---- makeScreenshot ----
	<target name="makeScreenshot">
		<property file="${tempFolder}/count.properties"/>
		<antcall target="makeScreenshotItem" inheritall="false">
			<param name="screenNum" value="${screenNum}"/>
			<param name="totalScreens"
value="${totalScreens}"/>
			<param name="screenshotRef"
value="${screenshotRef}"/>
		</antcall>
	</target>

---- makeScreenshotItem ----
	<target name="makeScreenshotItem">
		<if>
			<equals arg1="${screenNum}" arg2="1" />
			<then>
				<property name="prevScreen"
value="${totalScreens}"/>
				<property name="nextScreen" value="2"/>
			</then>
			<elseif>
				<equals arg1="${screenNum}"
arg2="${totalScreens}" />
				<then>
					<property name="prevScreen"
value="${totalScreens}"/>
					<decrease name="prevScreen"/>
					<property name="nextScreen"
value="1"/>
				</then>
			</elseif>
			<else>
					<property name="prevScreen"
value="${screenNum}"/>
					<decrease name="prevScreen"/>
					<property name="nextScreen"
value="${screenNum}"/>
					<increase name="nextScreen"/>
			</else>
		</if> 

		<!-- calculate width and height -->
		<imageinfo
file="${productsFolder}/${productRef}/screens/${screenshotRef}"
outputwidth="imageWidth" outputheight="imageHeight"/>

		<echo message="width: ${imageWidth}, height:
${imageHeight}"/>

		<copy file="${templatesFolder}/screen-template.html"
tofile="${templatesFolder}/${productRef}-${screenNum}.html"/>
		<fmpp
data="lang:properties(../${language}/lang.properties) +
products:xml(../${language}/products.xml) + targetRef:${productRef} +
prevRef:${prevScreen} + nextRef:${nextScreen} +
screenshotRef:${screenshotRef} + imageWidth:${imageWidth} +
imageHeight:${imageHeight}"
	
sourcefile="${templatesFolder}/${productRef}-${screenNum}.html"
outputfile="${outputFolder}/screens/${productRef}-${screenNum}.html"
		/>
		<delete
file="${templatesFolder}/${productRef}-${screenNum}.html"/>
		
		<!-- Copy image file to final folder -->
		<copy
file="${productsFolder}/${productRef}/screens/${screenshotRef}"
tofile="${outputFolder}/screens/${screenshotRef}"/>
				
		<!-- Increase property -->
		<propertyfile file="${tempFolder}/count.properties"
comment="Counter">
			<entry key="screenNum" type="int" operation="+"
value="1"/>
		</propertyfile>
	</target>


The FMPP file:
--- screen-template.html ----
<#list products.list.product as item>
<#if item.@ref = targetRef>
<html>
<head>
<title>${item.@title}</title>
<link rel="StyleSheet" href="screens.css" type="text/css">
<script language="JavaScript">
<!--

function writeClose() {
  document.write("\074a href=\"javascript:window.close();\"\076\074img
src=\"close.gif\" width=\"33\" alt=\"${lang.close}\" height=\"33\"
border=\"0\"\076\074/a\076");
}

// -->
</script>
</head>
<body>
<table cellspacing="0" cellpadding="5" border="0" width="312"
height="413">
<tr>
<td colspan="3" width="312" height="362" align="center" valign="center"
bgcolor="#B4CDCA"><img src="${screenshotRef}" width="${imageWidth}"
height="${imageHeight}" class="BORDERED"></td>
</tr>
<tr>
<td align="left" valign="center" bgcolor="#90A8A5" style="border-top:
1px #000000 solid;"><a href="${targetRef}-${prevRef}.html"><img
src="prev.gif" width="33" height="33" border="0" alt="&lt;-
${lang.previous}"></a></td>
<td align="center" valign="center" bgcolor="#90A8A5" style="border-top:
1px #000000 solid;"><script language="JavaScript"><!--
writeClose();
// -->
</script>
<td align="right" valign="center" bgcolor="#90A8A5" style="border-top:
1px #000000 solid;"><a href="${targetRef}-${nextRef}.html"><img
src="next.gif" width="33" height="33" border="0" alt="${lang.next}
-&gt;"></a></td>
</tr>
</table>
</body>
</html>
</#if>
</#list>



This (and more code) is used to generate the website located at
http://www.uworks.net . You can see the results by going to
http://www.uworks.net/products.html and click on "Screenshots" (there's
one for each product). 

There's no thumbnail, but the code to do it is quite trivial, if you use
that image task. The reason why I wanted a pure ant solution is because
it generates code for WML, XHTML Basic (for mobile phones) and HTML.

An automated task to generate screenshots from a photo folder would be
quite cool, maybe I'll implement it if I got time :)

Regards,
Josep del Río

-----Original Message-----
From: Daniels, Doug [mailto:Doug.Daniels@gdc4s.com] 
Sent: martes, 27 de julio de 2004 6:13
To: Ant Users List
Subject: Photo Album website generation using ANT

Hi,

I was wondering if anyone had any ideas what external tools I could use
with ANT to automate the building/updating of an online photo album.

Here is the scenario:

I take digital photos every weekend or so and I store them in a
directory IE: c:\photos\ThisWeek-2004-07-26

Then I use Dreamweaver/Fireworks to create a Web Photo Album with
thumbnails and specified thumbnails per line etc. It then outputs it to
c:\web\photos\ThisWeek-2004-07-26\index.html

So I was thinking it'd be nifty if I could piece together some kind of
ANT solution that would let me do all this by running an ant script in
my c:\photos directory that would check if all my generated albums are
up to date, and if not it would generate the necessary ones in
c:\web\photos.

So I've looked into the external tools and I think I'm going to need to
use the ANT image processing tasks from:
Jakarta ANT Image: http://www.mullassery.com/software/ANT/

Also using FMPP for creating the static HTML pages
http://fmpp.sourceforge.net/

I was thinking maybe I could provide some kind of XML style for how each
photoalbum should look like, and be able to change it in the ANT
command.

So I was thinking the ANT command would look something like this:

<WebPhotoAlbum src="C:\photos\ThisWeek-2004-07-26"
dest="c:\web\photos\ThisWeek-2004-07-26"/>

and then there would be additional optional paramaters for things like:
thumbWidth, thumbHeight, thumbCol, scale (scale original to smaller %
version). Maybe even a style="style.xsl" or .xml, depending on how the
photoalbum style is defined.

Then I could use ant-contrib foreach task to loop over every directory
in C:\photos, generating a 

<WebPhotoAlbubm src="${PhotoAlbum}" dest="${destDir}\${AlbumName}"/>

Has anyone attempted anything like this or has any ideas on how I should
proceed?

~Doug Daniels

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message