School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,424 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,498 people online right now. Registration is fast and FREE... Join Now!




Looping over a directory query to make a photo gallery

 

Looping over a directory query to make a photo gallery

xheartonfire43x

3 Jun, 2009 - 05:13 AM
Post #1

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 260



Thanked: 2 times
My Contributions
I am building a photo gallery that I don't want to plug into a DB for quick re-usability. When a user uploads an image it uploads the image into a folder called photos and every user has there own folder titled #firstname#_#lastname# in that folder. The directory query keeps the folder name in a variable called directory and the file name in a variable called name. So I have cfscript that will pull the folder name and then the file name and push them together.

CODE

<cfdirectory action="list" directory="#localphotopath#" name="PhotoDirectory" listinfo="all" recurse="yes" type="file">
<cfdump var="#PhotoDirectory#" expand="no">

<table cellpadding="3" cellspacing="3" border="0">
    <thead>
        <tr>
         <th colspan="4">Full Photo Gallery</th>
        </tr>
        <tr>
            <td colspan="4" align="left"><a href="/choosegallery.cfm">View Photo's By Name</a></td>
        </tr>
    </thead>
    <tbody>
        <cfset col = 0>
        <cfoutput query="photodirectory">
            <cfscript>
                file = photodirectory.name;
                filefolder = listGetAt(directory,5,"\");
            </cfscript>
                    <!---fullpath = filefolder & "/" & file;--->
                <cfdump var="#filefolder#"><br>
                <cfdump var="#file#">
        
            
        </cfoutput>
    </tbody>
</table>


The problem is that when I dump the file variable it returns an empty structure, but when I dump the full cfdirectory variable it shows file names in the name column.

User is offlineProfile CardPM
+Quote Post


CR250

RE: Looping Over A Directory Query To Make A Photo Gallery

11 Jun, 2009 - 10:30 AM
Post #2

D.I.C Head
**

Joined: 14 Jun, 2008
Posts: 54



Thanked: 2 times
My Contributions
Can you post a screen shot of the dump.
User is offlineProfile CardPM
+Quote Post

xheartonfire43x

RE: Looping Over A Directory Query To Make A Photo Gallery

11 Jun, 2009 - 04:03 PM
Post #3

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 260



Thanked: 2 times
My Contributions
I was able to fix it. I don't remember how I did. I am sorry I should have posted the solution.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:19AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month