Fast Way to get a Path to files in thumbnail folders

Charles E Buchwald charles at buchwald.ca
Sun Aug 12 11:54:13 EDT 2012


How about setting the item delimiter to "/" and using chunk operations, instead of regex?
(Not that it would be hard to use regex, but generally LC code is even easier....)

On 2012-08-11, at 11:57 PM, Brahmanathaswami <brahma at hindu.org> wrote:

> 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)
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list