i'm writing a script which builds an array for the pics in a dir
it also builds separate array for the thumbs
let's say the path to the dir is
$var1='/home/public_html/pics/'
i have a variable where the user sets the path to the thumb directory relatively
for example if he sets $var2='thumbs/' that's ok
but in some cases the thumbs are one level up, in that case i tried with $var2='../'
after that i'm doing
$nav_file_corrected=$var1 . $var2;
if ( $dh = opendir($nav_file_corrected) )
{
while ( false !== ( $file = readdir($dh) ) )
{
if(!strpos($file, "$movie_thumb_prefix")===false) $catch_thumbs[]=$movie_path_correction . $file;
}
}
but i get this error
Warning: opendir(/home/public_html/pics/../): failed to open dir: No such file or directory
well the trick is working in plain html, i mean
<img src="/home/public_html/pics/../1.jpg">
opens
/home/public_html/1.jpg
but php does not want to open such paths
the vars and paths here are just an example to show you the logic in thereal script i can't just set another full path for $var2, because the $var1 is generated dinamicly
in short: i need to be able to make correction to the path in $var1 by adding $var2 at the end ot the $var1 string
this isn't problem for sub-directories, but how to make it possible for parent directories?