Fast Way to get a Path to files in thumbnail folders

Brahmanathaswami brahma at hindu.org
Sun Aug 12 00:57:31 EDT 2012


I'm working on  catalog delivery system in our new web site.

one of the media types is "slideshow" and we have a path that we can 
programatically build from the database data that knows what year the 
photos were taken and has a file ID that match the folder on disk... 
After that we also know that the thumbnail/image we want for a 
gallery/catalog view is going to be in a folder call "preview"

We also really don't care which thumbnail we use for the catalog,

So of course we could do something like this

on a repeat loop

put "/media/slideshows/" & tYear & "/" & tFileID & "/preview" into 
tThumbsFolder
set the defaultfolder to tThumbsFolder=
put line 1 of the files into tGalleryThumb

# then create small function to build the image tag:

put format ("img src=\"" &tThumbsFolder & "/preview/" & tGalleryThumb & 
"\" />" into tGalleryImage

and then push that in the table. That's pretty obvious

But I've had trouble in the past with repeatedly with resetting the 
default folder on a loop like this and it seems like a lot of disk 
reading when we really don't care which file we use and we also a) know 
there will always be one and b) it always ends in *.jpg

I am wondering if there is some reg-ex magic that I could use to just 
read the first file in say this folder:

/media/slideshows/2008/2008-01-08_cambodia/preview/*.jpg

where by I can avoid having to repeatedly reset the defaultfolder and 
get "the files"

i suppose I could use a shell cmd but if you use something like

"/media/slideshows/2008/2008-01-08_cambodia/preview/*.jpg" in a shell 
you will get all the files in the folder and not just the first one.

Any ideas?

Brahmanathaswami (new name of he who was formerly Sivakatirswami)






More information about the use-livecode mailing list