rendered paste body<?phpfunction resolverelatives($arr) { $new = array(); foreach ($arr as $path) { if ($path === '.') continue; if ($path === '..' and count($new)) {array_pop($new); continue;} $new[] = $path; } return $new;}function mappath($from, $to, $sep = DIRECTORY_SEPARATOR) { $arrfrom = explode($sep, $from); $arrto = explode($sep, $to); if (!strlen($arrto[0]) and strlen($arrfrom[0])) return $to; elseif (strlen($arrto[0]) and !strlen($arrfrom[0])) { user_error(__FUNCTION__.' Can\'t map path from absolute to relative path.'); return false; } while (count($arrfrom) and count($arrto) and $arrfrom[0] === $arrto[0]) {array_shift($arrfrom); array_shift($arrto);} $uplen = count($arrfrom)-1; $newpath = array(); for ($i = 0; $i < $uplen; $i++) $newpath[] = '..'; foreach ($arrto as $aaaah) $newpath[] = $aaaah; return implode($sep, $newpath);}echo '<img src="'.mappath($_SERVER['PHP_SELF'], '/images/test.jpg').'" />';?>