Sorting Image Thumbs from a pile
December 1, 2011 7:54 PM Subscribe
Lazy man's image sort: What is the easiest way to grab this batch of image thumbs from my mysql web database to use on my Windows machine?
posted by maxwelton to Computers & Internet (3 answers total)
I have a bunch of images in a database, and I want to grab the already extant thumbnails of certain groups of them. They are currently stored in a YYYYMM directory tree--the file names are completely random, with no associating metadata. My database contains pointers to these files along with a bunch of other information about them, such as category and author.
For another project, I need all of the thumbnails of a certain category and author in one place, on my local workstation. The query is easy to write, obviously, but I'm kind of stymied as to how best grab the result. I do not have a copy of mysql running locally.
My first thought was to simply place them all on a single web page on the server and save it from Firefox; this would seemingly save all of the images into one place on my local box (I don't care about the file names at that point). But: One of the queries returns 27,000 results. Even at an average image size of only 1.5K that's a big web page, probably too big to not crash and burn, eh? I liked this idea because it's about as lazy a way to do this as I can imagine, but it seems destined to blow something up. Or will it work?
Another thought was to simply copy the files returned by the query from their native directory to a "results" directory and grab that batch via FTP. Again, I think 27,000 file copies will probably take too long for PHP to process on my shared host, and a directory with 27K items is a bit unwieldy to download, isn't it?
I have the YYYYMM directories and images backed up locally, so another option, if I knew how, would be to save the query results as a text file and somehow, with an unknown program or script, use that to copy the relevant local files to a new local "results" directory (I run Windows 7). I could easily format the output text file to say things like "cp z:\\local\file\tree\201101\aBdDgl.jpg z:\\local\file\tree\results\cat1author1\", with each file on a new line...but I lack the knowledge of how to take that text document and do anything useful with it. Is this the best way, and if so, what does the text document contain, and how do I run it?
I should note the files actually live on my Linux server, which I have a friend admin for me, since my expertise is not systems and I don't want it to be. But running UNIX commands or feeding that text file through some sort of program on that side is possible, though I'd be even more in the dark there.
Any other ideas welcome!