diff --git a/functions.php b/functions.php index 90c9811..3f08d20 100644 --- a/functions.php +++ b/functions.php @@ -7,6 +7,7 @@ function microtime_float() { function makeThumb($item = "") { if ( $item == "" ) { return false; } + $prefix = (substr(getcwd(), -4) == "ajax") ? "../" : ""; if ( is_dir($item) ) { $isfolder = true; $folder = $item; @@ -23,12 +24,12 @@ function makeThumb($item = "") { if ( count($files) == 0 ) { return false; } reset($files); $comic = $folder . "/" . current($files); - $outfile = THUMBSDIR . substr($folder, strlen(COMICSDIR)) . "_oem"; + $outfile = $prefix . THUMBSDIR . substr($folder, strlen(COMICSDIR)) . "_oem"; } elseif ( is_file($item) ) { $isfolder = false; $file = $item; $comic = $file; - $targetdir = THUMBSDIR . substr(dirname($file), strlen(COMICSDIR)) . "/"; + $targetdir = $prefix . THUMBSDIR . substr(dirname($file), strlen(COMICSDIR)) . "/"; if ( !is_dir($targetdir) ) { mkdir($targetdir, 0755, true); }