Page 1 of 1

File Properties | Spotlight Comments

Posted: Thu Apr 17, 2008 11:02 pm
by gduron
I have a jpeg file object ($f) on my Mac and I would like to extract the spotlight comments from the picture. Is there a function that I can use in PHP to do it?


Here is my code:

Code: Select all

 
$dir = opendir($d);
$count = 0;
while ($f = readdir($dir)){
        if ($f!=='.' && $f!=='..') {
                $display_block =  $display_block . "<img src=\"pictures/$f\" height=\"200\" width=\"300\">\n";
                $count++;
        }
        if ($count == 3) {
                $display_block = $display_block . "<br>";
                $count = 0;
        }
}
 
 

Thanks in advance.

Re: File Properties | Spotlight Comments

Posted: Fri Apr 18, 2008 5:52 am
by onion2k
Nope. Spotlight stores comments separately to the file system so there's no way for PHP to access them.

It might be possible to write an extension that talked to Spotlight to get them. Other applications can definitely read the comments, but that'd be pretty tricky to code. Unless you're familiar with C programming and OSX's internals I doubt you'd succeed. It's certainly beyond my skill level.