protected function _replace($matches)
    {
        $webroot = null;
        if (defined('WWW_ROOT')) {
            $webroot = WWW_ROOT;
        }
        if (!empty($this->_settings['webroot'])) {
            $webroot = $this->_settings['webroot'];
        }

        $path = $matches['path'];
        if ($path[0] === '/') {
            $imagePath = $webroot . rtrim($path, '/');
        } else {
            $imagePath = realpath(dirname($this->_filename) . DIRECTORY_SEPARATOR . $path);
        }
        if (file_exists($imagePath)) {
            $path = $this->_timestamp($imagePath, $path);
        }
        return $matches['prop'] . $path . $matches['trail'];
    }