Link to home
Start Free TrialLog in
Avatar of zakaz
zakaz

asked on

Read from directory add to db

Hello,

I am running CFMX 7 on our own server Win 2003. 800gb space,

I have just set up a new web directory structure with over 6000 images in it set up like below.

wwwroot/pics/summmer/img_2453663_66355.jpg
wwwroot/pics/summmer/img_2453663_66356.jpg
wwwroot/pics/summmer/img_2453663_66357.jpg  (etc)
wwwroot/pics/winter/img_2453663_66311.jpg
wwwroot/pics/winter/img_2453663_66311.jpg  (etc)

Lots of folders with hundreds of images in each.

What i need to do is for coldfusion to read the name of the images, and store it and it's route on a db (don't worry about the storage code that is not a problem)

Something behind this... I have an co located server with 600 thumbnails on it live, the order form is currently sent to the account manager who finds the 300dpi image on the server and sends it out on a CD, as you can see this is not the best way.

What i have is set up our inhouse server with the 300dpi images on, i am going to pass the image name accross from the current order form and send out the image.

I do not want to type in 6000+ image names and locations?

Please any help?
Avatar of trailblazzyr55
trailblazzyr55


This is just an idea and somthing I haven't tried before, but may be of some use???

<cffile    action = "read"    
             file = "../pics/summmer/"  
             variable = "pic_locations"   >

<cfoutput>#pic_locations#</cfoutput>

I don't have any idea if this will work, at the moment I don't have anythnig to test on either :o)

just an idea...
Are you wanting to do this as images are uploaded to the server as part of a web app?  Do you just want to be able to find an image based upon it's name?  There are a couple of different approaches based upon your unique requirements and all should be rarther simple.  Can you give us a little more information to work with?
I'm not sure exactly how to go about this,

but what I believe he is asking is how to dynamically populate a database record say "Image_Name" with the name of images in a directory (he says about 600 worth) and store another value "Image_Location" with the path to those images in a table without having to hand cramp everything to the table...

by say storing the values as variables and doing an SQL insert to update his new database.

I would also be interested if you have an easy way of doing this!

I think then he can use this table to call images on a variety of pages with his new database..?

Regards,
~trail
ASKER CERTIFIED SOLUTION
Avatar of mmc98dl1
mmc98dl1
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zakaz

ASKER

Excellent work you guys,

I will give these a taet today,

Thank You all,

Chris
Avatar of zakaz

ASKER

<p>The template path of the current page is:
<cfoutput>#GetCurrentTemplatePath()#</cfoutput>

<cfdirectory action="list" name="pics" directory="E:\wwwroot\Clients\b\bdw\images\" >


<p>
  <cfloop query="pics">
     <cfdirectory action="list" name="this" directory="E:\wwwroot\Clients\b\bdw\images\#pics.name#">
     <cfloop query="this">
          <!--- this.name contains all the file names in your directory --->
          <cfoutput>#this.directory##this.name#</cfoutput>
          <!--- You can use this info to store in db --->
     </cfloop>
  </cfloop>