I ended up revisiting an old photoalbum I have setup on a few sites (from a tutorial several years ago). In it the album uses a query and the resulting recordset to do all the work. HOWEVER, I used querysim when setting up and testing, and it never got changed. Now, instead of using a query I want to go through the directory automatically (using cfdirectory) to create a list of images and use this instead of my original query (or Querysim in this case).

So far this is what I have.....

*********************
Original Querysim example
============
<cf_querysim>
GetRecords
name
photo1.jpg
photo2.jpg
etc etc
</cf_querysim>

act_photos.cfm
==========
<!--- Define All Default Values If They Are Not Passed --->
<cfparam name="page" default="0">

<!--- Define All Initial Parameters --->
<cfset disp_page = #page# + 1>
<cfset block_size = 6>
<cfset block_pages = ceiling(GetRecords.recordcount/block_size)>
<cfset block_start = (page * block_size) + 1>
<cfset block_end = (page * block_size) + block_size>

<cfif block_end GT GetRecords.recordcount>
<cfset block_end = GetRecords.recordcount>
</cfif>

<!--- Make the array with 6 items --->
<cfset pic_array = ArrayNew(1)>

<!--- Make Arrays Have value of 0, so we can determine display --->
<cfloop from="1" to="6" index="i">
    <cfset pic_array[i] = 0>
</cfloop>

<cfset count = 1>
<!--- populate the arrays with values --->
<cfloop query="GetRecords" startrow="#((page*6)+1)#" endrow="#((page*6)+6)#">
    <cfset pic_array[count] = '#GetRecords.name#'>
    <cfset count = count + 1>
</cfloop>

====================

and here is the start of my directory list
======================

<cfset serverdir = "d:\serverpath\images\npc\random\">
<cfset httpdir = "http://www.urlname.com/images/npc/random">

<!--- retrieve all JPGs --->
<cfdirectory name="getJPG"
  action="">   directory="#serverdir#"
  filter="*.jpg" >

<!--- comma delimited list of all the jpg's --->
<cfparam name="imglist" default="">

<cfloop query="getJPG">
    <cfset GetRecords = listappend(imglist, name, ",")>
</cfloop>

So here I have my list...now how to use this instead of the querysim for output? I get stuck bcos originally I call the image from the query using the column title (ie name) but here it's a list so that's not possible.

TIA
Regards
Mark H
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to