On the heels of my previous app which used Apple's Spotlight searching capabilities to create your own personal search engine, I have written a new application to create your own web photo gallery from a Spotlight search.
All of the code is based off of the previous application, so there's no shockers to getting it setup on your own mac- just change the name in your head from 'search' to 'image' and you should be just fine.
The one thing that has changed is the search string being used. While the search engine was only searching for the contents of all files, we are search all files for a particular type.
In Mac OS X 10.5, groups of file types are placed into groups. As it happens, the _kMDItemGroupId of “all images” happens to be 13. So, in the search, we're just running something like:
mdfind _kMDItemGroupId = 13
from the command line and parsing the results which come back from the search.
Unfortunately, I have no clue what the GroupId is in 10.4, so this script will probably only work reliably in 10.5. Besides, don't you think it's time to upgrade?
Anyway, download is located over here. To use, check out the documents on the search app. They're very close together when it comes to code reuse.
Also, forgive me for calling it an 'image gallery'. It just pretty much outputs images and that's it. However, there's a lot of code out there that can show you how to turn an array of images into an actual gallery, so I didn't include all those bits in there. That, is an exercise left up to the Dear Reader to perform.
Enjoy!
tom
0 Comments.