File Properties | Spotlight Comments

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gduron
Forum Newbie
Posts: 1
Joined: Thu Apr 17, 2008 10:53 pm

File Properties | Spotlight Comments

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: File Properties | Spotlight Comments

Post 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.
Post Reply