The StreamWrapper class represents shared streams. Since not all streams are supported by the concept of a file system, there is no general method for this.
If the uri property of stream_get_meta_data does not work for your implementation , you can record information for open time and then access it through stream_get_meta_data , Example:
class MediaStream { public $localpath = null; public function stream_open($path, $mode, $options, &$opened_path) { $this->localpath = realpath(preg_replace('+^media://+', '/', $path)); return fopen($this->localpath, $mode, $options); } } stream_wrapper_register('media', 'MediaStream'); $fp = fopen('media://tmp/icon.png', 'r'); $data = stream_get_meta_data($fp); var_dump( $data['wrapper_data']->localpath );
Of course, there is always a brute force approach: after creating your resource, you can call fstat , which includes the device and the inode. Then you can open this device, go through its directory structure and find this inode. See here for an example.
bishop Jun 22 '15 at 17:08 2015-06-22 17:08
source share