diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-02-14 00:36:34 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-02-14 00:36:34 +0000 |
commit | 711ebcbf2c1906b6496711eb6973954ecb113d72 (patch) | |
tree | 625490d68f96f6aba3f93c484f6208e10cc9f3b8 /admin/thumbnail.php | |
parent | 03911f5aa32d4dd65d85b7dd81379fedd27bbef5 (diff) |
- thumbnails creation for all local sites (not only site id 1)
- urls for images in notification (rss & mail) is now correct
- removed "Recent pictures" from title in when the flat view is in effect
- removed unnecessary class="" from comments.tpl
- english language correction
- removed unused web service files
- set rating star button left & right margin to 0 (javascript)
- admin menu - put site manager and synchronize together
git-svn-id: http://piwigo.org/svn/trunk@1814 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/thumbnail.php | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/admin/thumbnail.php b/admin/thumbnail.php index 543b589cc..345d08b3e 100644 --- a/admin/thumbnail.php +++ b/admin/thumbnail.php @@ -2,10 +2,10 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) -// | file : $RCSfile$ +// | file : $Id$ // | last update : $Date$ // | last modifier : $Author$ // | revision : $Revision$ @@ -192,54 +192,57 @@ $template->assign_vars(array( $wo_thumbnails = array(); $thumbnalized = array(); + // what is the directory to search in ? $query = ' -SELECT galleries_url - FROM '.SITES_TABLE.' - WHERE id = 1 +SELECT galleries_url FROM '.SITES_TABLE.' + WHERE galleries_url NOT LIKE "http://%" ;'; -list($galleries_url) = mysql_fetch_array(pwg_query($query)); -$basedir = preg_replace('#/*$#', '', $galleries_url); +$result = pwg_query($query); +while ( $row=mysql_fetch_assoc($result) ) +{ + $basedir = preg_replace('#/*$#', '', $row['galleries_url']); + $fs = get_fs($basedir); -$fs = get_fs($basedir); -// because isset is one hundred time faster than in_array -$fs['thumbnails'] = array_flip($fs['thumbnails']); + // because isset is one hundred time faster than in_array + $fs['thumbnails'] = array_flip($fs['thumbnails']); -foreach ($fs['elements'] as $path) -{ - // only pictures need thumbnails - if (in_array(get_extension($path), $conf['picture_ext'])) + foreach ($fs['elements'] as $path) { - $dirname = dirname($path); - $filename = basename($path); - - // only files matching the authorized filename pattern can be considered - // as "without thumbnail" - if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) + // only pictures need thumbnails + if (in_array(get_extension($path), $conf['picture_ext'])) { - continue; - } - - // searching the element - $filename_wo_ext = get_filename_wo_extension($filename); - $tn_ext = ''; - $base_test = $dirname.'/thumbnail/'; - $base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.'; - foreach ($conf['picture_ext'] as $ext) - { - if (isset($fs['thumbnails'][$base_test.$ext])) + $dirname = dirname($path); + $filename = basename($path); + + // only files matching the authorized filename pattern can be considered + // as "without thumbnail" + if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) { - $tn_ext = $ext; - break; + continue; + } + + // searching the element + $filename_wo_ext = get_filename_wo_extension($filename); + $tn_ext = ''; + $base_test = $dirname.'/thumbnail/'; + $base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.'; + foreach ($conf['picture_ext'] as $ext) + { + if (isset($fs['thumbnails'][$base_test.$ext])) + { + $tn_ext = $ext; + break; + } + } + + if (empty($tn_ext)) + { + array_push($wo_thumbnails, $path); } } - - if (empty($tn_ext)) - { - array_push($wo_thumbnails, $path); - } - } -} + } // next element +} // next site id // +-----------------------------------------------------------------------+ // | thumbnails creation | // +-----------------------------------------------------------------------+ |