org\bovigo\vfs\vfsStream::path PHP Method

path() public static method

restores the path from the url
public static path ( string $url ) : string
$url string vfsStream url to translate into path
return string
    public static function path($url)
    {
        // remove line feeds and trailing whitespaces and path separators
        $path = trim($url, " \t\r\n\v/\\");
        $path = substr($path, strlen(self::SCHEME . '://'));
        $path = str_replace('\\', '/', $path);
        // replace double slashes with single slashes
        $path = str_replace('//', '/', $path);
        return rawurldecode($path);
    }

Usage Example

コード例 #1
0
 public function successCompress($file)
 {
     if (preg_match('#[^-]+-([^.]+)[.](png|jpe?g)$#', basename($file), $match)) {
         $key = $match[1];
     } else {
         $key = null;
     }
     $input = filesize($file);
     switch ($key) {
         case "thumbnail":
             $output = 81;
             break;
         case "medium":
             $output = 768;
             break;
         case "large":
             $output = 6789;
             break;
         case "post-thumbnail":
             $output = 1000;
             break;
         default:
             $output = 10000;
     }
     $this->vfs->getChild(vfsStream::path($file))->truncate($output);
     return array('input' => array('size' => $input), 'output' => array('size' => $output));
 }
All Usage Examples Of org\bovigo\vfs\vfsStream::path