src/ImageStack/Cache/RawFileCache.php
protected function getFilename($id, $metadata = false)
    {
        $this->assertValidId($id);
        $path = rtrim(dirname($id), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        if ($level = $this->getOption('hash_tree', 0)) {
            $level = min(32, $level);
            $md5 = md5($id);
            for ($i = 0; $i < $level; ++$i) {
                $path .= $md5[$i] . DIRECTORY_SEPARATOR;
            }
        }
        $path .= basename($id);
        if ($metadata) {
            $root = $this->getOption('metadata_root', $this->getOption('root') . DIRECTORY_SEPARATOR . '.cache_metadata');
        } else {
            $root = $this->getOption('root');
        }
        return rtrim(sanitize_path($root . DIRECTORY_SEPARATOR . $path), DIRECTORY_SEPARATOR);
    }
protected function getFilename($id, $metadata = false)
    {
        $this->assertValidId($id);
        $path = rtrim(dirname($id), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        if ($level = $this->getOption('hash_tree', 0)) {
            $level = min(32, $level);
            $md5 = md5($id);
            for ($i = 0; $i < $level; ++$i) {
                $path .= $md5[$i] . DIRECTORY_SEPARATOR;
            }
        }
        $path .= basename($id);
        if ($metadata) {
            $root = $this->getOption('metadata_root', $this->getOption('root') . DIRECTORY_SEPARATOR . '.cache_metadata');
        } else {
            $root = $this->getOption('root');
        }
        return rtrim(sanitize_path($root . DIRECTORY_SEPARATOR . $path), DIRECTORY_SEPARATOR);
    }
protected function getFilename ( $ id , $ metadata = false ) { $ this -> assertValidId ( $ id ) ; $ path = rtrim ( dirname ( $ id ) , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; if ( $ level = $ this -> getOption ( 'hash_tree' , 0 ) ) { $ level = min ( 32 , $ level ) ; $ md5 = md5 ( $ id ) ; for ( $ i = 0 ; $ i < $ level ; ++ $ i ) { $ path .= $ md5 [ $ i ] . DIRECTORY_SEPARATOR ; } } $ path .= basename ( $ id ) ; if ( $ metadata ) { $ root = $ this -> getOption ( 'metadata_root' , $ this -> getOption ( 'root' ) . DIRECTORY_SEPARATOR . '.cache_metadata' ) ; } else { $ root = $ this -> getOption ( 'root' ) ; } return rtrim ( sanitize_path ( $ root . DIRECTORY_SEPARATOR . $ path ) , DIRECTORY_SEPARATOR ) ; }
Get the filename for the given ID.
@param string $id
@param string $metadata get the metadata filename
@return string
Get the filename for the given ID .