Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Put caches in a folder per user.

Fixes possible album name conflicts.
  • Loading branch information...
commit e9a6e3e170577d70b7aaab3ac007e708d98f4355 1 parent fdf7c64
Auke Kok authored

Showing 4 changed files with 12 additions and 13 deletions. Show diff stats Hide diff stats

  1. +0 2  TODO
  2. +7 7 album-watch.php
  3. +4 3 db.php
  4. +1 1  image.php
2  TODO
... ... @@ -1,8 +1,6 @@
1 1
2 2 - Refine installation instructions a bit with examples and cmdlines
3 3
4   -- make a cache folder per user: $cache_base/$user/$album/$object
5   -
6 4 - check input size against allowed list
7 5
8 6 - use ffmpeg to get "Date Created" from video files in bg daemon. Somehow
14 album-watch.php
@@ -27,11 +27,13 @@ function do_file($path, $album, $user)
27 27 }
28 28
29 29 # might need to mkdir first
30   - if (!is_dir($cache_base . "/" . $album))
31   - mkdir($cache_base . "/" . $album);
  30 + if (!is_dir($cache_base . "/" . $user))
  31 + mkdir($cache_base . "/" . $user);
  32 + if (!is_dir($cache_base . "/" . $user . "/" . $album))
  33 + mkdir($cache_base . "/" . $user . "/" . $album);
32 34
33 35 # thumbnail
34   - $t = $cache_base . "/" . $album . "/" . $i['filename'] . ".thm";
  36 + $t = $cache_base . "/" . $user . "/" . $album . "/" . $i['filename'] . ".thm";
35 37 if (!is_file($t)) {
36 38 echo 'ffmpeg -i "' . $path . '" -ss 0 -vframes 1 -f mjpeg -an "' . $t . '.in"' . "\n";
37 39 system('ffmpeg -i "' . $path . '" -ss 0 -vframes 1 -f mjpeg -an "' . $t . '.in" > /dev/null 2>&1');
@@ -61,7 +63,7 @@ function do_file($path, $album, $user)
61 63 }
62 64
63 65 # mp4
64   - $t = $cache_base . "/" . $album . "/" . $i['filename'] . ".mp4";
  66 + $t = $cache_base . "/" . $user . "/" . $album . "/" . $i['filename'] . ".mp4";
65 67 if (!is_file($t)) {
66 68 # most of my stuff is in AVI or MP4 format, and doesn't need any tuning to come out OK
67 69 # with mp4 format recoding
@@ -70,7 +72,7 @@ function do_file($path, $album, $user)
70 72 }
71 73
72 74 # ogv
73   - $t = $cache_base . "/" . $album . "/" . $i['filename'] . ".ogv";
  75 + $t = $cache_base . "/" . $user . "/" . $album . "/" . $i['filename'] . ".ogv";
74 76 if (!is_file($t)) {
75 77 # with -sameq or no params, OGV's come out very pixelated and small. Instead
76 78 # code these at -qscale 6, which is small but plenty res for the web.
@@ -135,8 +137,6 @@ function do_file($path, $album, $user)
135 137 continue;
136 138 }
137 139
138   - $cd = $cache_base . "/" . $album;
139   -
140 140 $ih = opendir($d . "/" . $album);
141 141 $image = readdir($ih);
142 142 while ($image) {
7 db.php
@@ -59,7 +59,7 @@
59 59 unset($date);
60 60 unset($albumdate);
61 61
62   - $cd = $cache_base . "/" . $album;
  62 + $cd = $cache_base . "/" . $users[$x] . "/" . $album;
63 63 $ca = $cd . "/" . "db.js";
64 64
65 65 # cache intercept
@@ -168,9 +168,10 @@
168 168 echo $a;
169 169
170 170 # write cache entry
171   - if (!is_dir($cd)) {
  171 + if (!is_dir($cache_base . "/" . $users[$x]))
  172 + mkdir($cache_base . "/" . $users[$x]);
  173 + if (!is_dir($cd))
172 174 mkdir($cd);
173   - }
174 175
175 176 $fp = fopen($ca, "w");
176 177 if ($fp) {
2  image.php
@@ -134,7 +134,7 @@ function pass_file_and_exit($file) {
134 134 #header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($obj)).' GMT', true, 200);
135 135 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + (80640 * 180)) . ' GMT', true, 200);
136 136
137   -$cache_path = $cache_base . "/" . $album;
  137 +$cache_path = $cache_base . "/" . $user . "/" . $album;
138 138
139 139 if (!is_dir($cache_path))
140 140 mkdir($cache_path);

0 comments on commit e9a6e3e

Please sign in to comment.
Something went wrong with that request. Please try again.