I am running MAMP and using PHP to read the names of all the files in a given folder. I would like to create an alias for certain images in another folder, and have PHP resolve these to their actual path. I know how to create symlinks that will work this way, but I would like to allow non-tech savvy web owners to use the Mac OS features that they are familiar with.
I have created a PHP script in the same folder as a alias that I have named test
:
<?php
if (is_link ("test")) {
echo "is link";
} else {
echo "is not link";
}
?>
This echoes "is not link". I have tried using the fread() command on the link, but PHP seems to hang. It neither logs an error nor responds. I have tried opening the alias in a hex editor to see what it contains... but the hex editor opens what seems to be a huge file (if the alias is to a file), or opens the target folder (if the alias is to a folder).
Is there a way to help PHP to resolve the path in the alias? Is there an AppleScript function that I can call?