Resolving Windows virtual directory paths
Posted: Fri Apr 03, 2009 12:12 pm
Can't work out how to do this. It may be specific to Windows.
I have a large (MySQL) database of photo images on a PC server running IIS. The image information is in the database, the images themselves are on a separate Windows drive (I:) in a set file structure that the PHP code can navigate from the image information. Since the webroot is the usual c:\inetpub\wwwroot, and the images are elsewhere (I:), there is a virtual directory set up in IIS to allow access from the web root (ie the virtual directory 'dbimages' actually points to I:\dbimages).
So far, so good. All works fine. The virtual directory references all work correctly in the generated web pages.
However one of the things the PHP code needs to do is physically copy images from their location on I:. I do this using the PHP copy() function. However, copy() will NOT resolve a virtual directory path. Ie the path './dbimages/x/y/z/thisimage.jpg' which works fine in the webpages does not work as the source reference for copy, it has to be 'I:/dbimages/x/y/z/thisimage.jpg' instead. This means that the true drive location, I:, needs to be hardcoded, or at least explicitly user settable, for the PHP code.
So my question is this: is there a way of resolving a virtual directory path to a true physical path on the machine on which it is running?
I have a large (MySQL) database of photo images on a PC server running IIS. The image information is in the database, the images themselves are on a separate Windows drive (I:) in a set file structure that the PHP code can navigate from the image information. Since the webroot is the usual c:\inetpub\wwwroot, and the images are elsewhere (I:), there is a virtual directory set up in IIS to allow access from the web root (ie the virtual directory 'dbimages' actually points to I:\dbimages).
So far, so good. All works fine. The virtual directory references all work correctly in the generated web pages.
However one of the things the PHP code needs to do is physically copy images from their location on I:. I do this using the PHP copy() function. However, copy() will NOT resolve a virtual directory path. Ie the path './dbimages/x/y/z/thisimage.jpg' which works fine in the webpages does not work as the source reference for copy, it has to be 'I:/dbimages/x/y/z/thisimage.jpg' instead. This means that the true drive location, I:, needs to be hardcoded, or at least explicitly user settable, for the PHP code.
So my question is this: is there a way of resolving a virtual directory path to a true physical path on the machine on which it is running?