Solved

Coldfusion photogallery

Posted on 2009-04-05
5
815 Views
Last Modified: 2013-12-24
Hello experts.
On www.coldfusionjedi.com i found a link to Spry photo gallery Demo :http://www.dbooth.net/photos/index.htm#
This needs the simpleviewer from http://www.airtightinteractive.com/simpleviewer/.
I have downloaded all the files and i'm asking how can i use the code getting the photos dynamically with a query.
The query is:
 <cfquery name="WADAphoto" datasource="#request.dsn#">
 SELECT a.Photo1, a.Photo2, a.Photo3, a.Photo4,a.Photo5, a.Photo6, a.Photo7, a.Photo8
 From dbo.artikel a
 WHERE Art_ID = <cfqueryparam value="#URL.Art_ID#" cfsqltype="cf_sql_numeric">
 </cfquery>
(there is a folder images/big and images/thumbs
Here are all the downloaded files:
index:

<!-- saved from url=(0014)about:internet -->

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>SimpleViewer</title>

<!-- Download SimpleViewer at www.airtightinteractive.com/simpleviewer -->

<script type="text/javascript" src="swfobject.js"></script>

<style type="text/css">	

	/* hide from ie on mac \*/

	html {

		height: 100%;

		overflow: hidden;

	}

	

	#flashcontent {

		height: 100%;

	}

	/* end hide */
 

	body {

		height: 100%;

		margin: 0;

		padding: 0;

		background-color: #181818;

		color:#ffffff;

		font-family:sans-serif;

		font-size:20;

	}

	

	a {	

		color:#cccccc;

	}

</style>

</head>

<body>

	<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>	

	<script type="text/javascript">

	

		var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");

		

		// SIMPLEVIEWER CONFIGURATION OPTIONS

		// To use an option, uncomment it by removing the "//" at the start of the line

		// For a description of config options, go to: 

		// http://www.airtightinteractive.com/simpleviewer/options.html

		

		//fo.addVariable("xmlDataPath", "gallery.xml");

		//fo.addVariable("firstImageIndex", "5");	

		//fo.addVariable("langOpenImage", "Open Image in New Window");

		//fo.addVariable("langAbout", "About");	

		//fo.addVariable("preloaderColor", "0xFFFFFF");

		

		fo.write("flashcontent");	

	</script>	

</body>

</html>

gallery:

<?xml version="1.0" encoding="UTF-8"?>

<simpleviewergallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xFFFFFF" frameWidth="20" stagePadding="40" navPadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" vAlign="center" hAlign="center" title="SimpleViewer Gallery" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath="">

<image>

	<filename>wide.jpg</filename>

	<caption><![CDATA[Captions can be HTML formatted. Supported tags are <b>bold</b>, <u>underline</u>, <i>italics</i>, <u><a href="http://www.google.com" target="_blank">hyperlinks</a></u>, linebreaks<br> and <font color="#ffff00" size="30">font tags</font>.]]></caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections.</caption>	

</image>

<image>

	<filename>wide.jpg</filename>

	<caption>The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me? " he thought. It wasn't a dream.</caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>Caption 4</caption>	

</image>

<image>

	<filename>wide.jpg</filename>

	<caption>Caption 5</caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>Caption 6</caption>	

</image>

<image>

	<filename>wide.jpg</filename>

	<caption>Caption 7</caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>Caption 8</caption>	

</image>

<image>

	<filename>wide.jpg</filename>

	<caption>Caption 9</caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>Caption 10</caption>	

</image>

<image>

	<filename>wide.jpg</filename>

	<caption>Caption 11</caption>	

</image>

<image>

	<filename>tall.jpg</filename>

	<caption>Caption 12</caption>	

</image>

</simpleviewergallery>

photindex:

<!-- saved from url=(0014)about:internet -->

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>SimpleViewer</title>

<!-- Download SimpleViewer at www.airtightinteractive.com/simpleviewer -->

<script type="text/javascript" src="swfobject.js"></script>

<style type="text/css">	

	/* hide from ie on mac \*/

	html {

		height: 100%;

		overflow: hidden;

	}

	

	#flashcontent {

		height: 100%;

	}

	/* end hide */
 

	body {

		height: 100%;

		margin: 0;

		padding: 0;

		background-color: #181818;

		color:#ffffff;

		font-family:sans-serif;

		font-size:20;

	}

	

	a {	

		color:#cccccc;

	}

</style>

</head>

<body>

	<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>	

	<script type="text/javascript">

	

		var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");

		

		// SIMPLEVIEWER CONFIGURATION OPTIONS

		// To use an option, uncomment it by removing the "//" at the start of the line

		// For a description of config options, go to: 

		// http://www.airtightinteractive.com/simpleviewer/options.html

		

		//fo.addVariable("xmlDataPath", "gallery.xml");

		//fo.addVariable("firstImageIndex", "5");	

		//fo.addVariable("langOpenImage", "Open Image in New Window");

		//fo.addVariable("langAbout", "About");	

		//fo.addVariable("preloaderColor", "0xFFFFFF");

		

		fo.write("flashcontent");	

	</script>	

</body>

</html>

Open in new window

0
Comment
Question by:Panos
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
duncancumming earned 500 total points
Comment Utility
So your gallery page is an XML file of the form:
<image>
        <filename></filename>
        <caption></caption>
</image>

All you need to do is create a .cfm page that includes your query, outputs the query in an xml format, and uses cfcontent to say the page is an XML document.


<cfquery name="WADAphoto" datasource="#request.dsn#">

SELECT a.Photo1, a.Photo2, a.Photo3, a.Photo4,a.Photo5, a.Photo6, a.Photo7, a.Photo8

From dbo.artikel a

WHERE Art_ID = <cfqueryparam value="#URL.Art_ID#" cfsqltype="cf_sql_numeric">

</cfquery>
 

<cfcontent type="text/XML">

<?xml version="1.0" encoding="UTF-8"?>

<simpleviewergallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xFFFFFF" frameWidth="20" stagePadding="40" navPadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" vAlign="center" hAlign="center" title="SimpleViewer Gallery" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath="">

<cfoutput query="WADAphoto">

    <cfloop index="i" from="1" to="8">

        <image>

                <filename>#WADAphoto["Photo" & i]#</filename>

                <caption>???</caption>    

        </image>

    </cfloop>

</cfoutput>

</simpleviewergallery>

</cfcontent>

Open in new window

0
 
LVL 16

Expert Comment

by:duncancumming
Comment Utility
of course the closing </cfcontent> isn't required!
0
 
LVL 2

Author Comment

by:Panos
Comment Utility
Hi duncancumming:
the name of this page will be gallery.cfm?
0
 
LVL 2

Author Closing Comment

by:Panos
Comment Utility
Thank you for your help
regards
panos
0
 
LVL 16

Expert Comment

by:duncancumming
Comment Utility
yes.  I couldn't see where in your sample code you actually specify the name of the gallery XML file.  However I assume that is trivial.  When it comes to that part, just specify it as gallery.cfm.  

It'll need to be a .cfm page if you want ColdFusion code to execute (i.e your query).
 [not strictly true, but for simplicity's sake let's say it is]
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now