foto: keep data subdirectory in thumb paths
[minimedit.git] / foto / index.php
index eadda9103ac187690c09b7e04a6c942b06b050ff..f77b9c18414e1553e698e8a63e7ffd28b9b67423 100644 (file)
@@ -34,7 +34,7 @@ function showthumb($path)
 {
        // assume all album entries are symlinks to archive originals
        $target = preg_replace('{^(\.\./)*}', '', readlink($path));
-       $thumb = preg_replace('{^data/}', 'thumb/200/', $target);
+       $thumb = 'thumb/200/' . $target;
 
        @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
        $imgtag = 'img src="/'.$thumb.'"';
@@ -57,7 +57,7 @@ if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
                $cover = "$path/index.jpg";
                if (!file_exists($cover)) $cover = 'foto/index.jpg';
                if (is_link($cover)) {
-                       $cover = preg_replace('{^(?:\.\./)*data/}', 'thumb/100/', readlink($cover));
+                       $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
                }
 
                $html = '<img src="/'.$cover.'" />';