Skip to content
Browse files

Switched thumbnail naming to filename_thumb.jpg

  • Loading branch information...
1 parent 3ff4b06 commit 23a4292d6527ebe3b38cc9953432d53ef7334121 Robert Bieber committed May 15, 2012
Showing with 11 additions and 5 deletions.
  1. +4 −2 scripts/genthumbs.py
  2. +7 −3 scripts/web/index.php
View
6 scripts/genthumbs.py
@@ -32,12 +32,14 @@ def scandir(root):
# Scan for files
for f in sorted(os.listdir(root)):
path = os.path.join(root, f)
- thumbpath = os.path.join(root, 'thumb' + f)
+ thumbname = os.path.splitext(f)[0] + '_thumb' + os.path.splitext(f)[1]
+ thumbpath = os.path.join(root, thumbname)
if os.path.isdir(path):
# Queueing up directories to scan after every file is checked
dirs.append(path)
- elif os.path.splitext(path)[1].lower() == '.jpg' and f[0:5] != 'thumb':
+ elif (os.path.splitext(path)[1].lower() == '.jpg'
+ and os.path.splitext(path)[0][-5:] != 'thumb'):
files.append((path, thumbpath))
# Then recurse on directories
View
10 scripts/web/index.php
@@ -181,16 +181,19 @@
$fileURIs = array();
foreach($files as $k => $v)
{
+ $info = pathinfo($v);
+
if($v == '.' || $v == '..'
- || substr($v, 0, 5) == 'thumb')
+ || substr($info['filename'], -5) == 'thumb')
continue;
$photoPath = PHOTOS_LOCAL . '/'
. trim(strtoupper($_GET['serial']))
. '/' . $v;
$thumbPath = PHOTOS_LOCAL . '/'
. trim(strtoupper($_GET['serial']))
- . '/thumb' . $v;
+ . '/' . $info['filename'] . '_thumb.'
+ . $info['extension'];
if(!file_exists($thumbPath))
{
// If the thumbnail doesn't exist, create one
@@ -232,7 +235,8 @@
. '/' . $v;
$thumbWebPath = PHOTOS_WEB . '/'
. strtoupper(trim($_GET['serial']))
- . '/thumb' . $v;
+ . '/' . $info['filename'] . '_thumb.'
+ . $info['extension'];
if(substr($v, 0, 5) != "index" || $_GET['index'])
$fileURIs[$k] = array('photo' => $photoWebPath,

0 comments on commit 23a4292

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