Changeset 1814 for trunk/admin/thumbnail.php
- Timestamp:
- Feb 14, 2007, 1:36:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/thumbnail.php
r1635 r1814 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) 8 // | file : $ RCSfile$8 // | file : $Id$ 9 9 // | last update : $Date$ 10 10 // | last modifier : $Author$ … … 193 193 $thumbnalized = array(); 194 194 195 195 196 // what is the directory to search in ? 196 197 $query = ' 197 SELECT galleries_url 198 FROM '.SITES_TABLE.' 199 WHERE id = 1 198 SELECT galleries_url FROM '.SITES_TABLE.' 199 WHERE galleries_url NOT LIKE "http://%" 200 200 ;'; 201 list($galleries_url) = mysql_fetch_array(pwg_query($query)); 202 $basedir = preg_replace('#/*$#', '', $galleries_url); 203 204 $fs = get_fs($basedir); 205 // because isset is one hundred time faster than in_array 206 $fs['thumbnails'] = array_flip($fs['thumbnails']); 207 208 foreach ($fs['elements'] as $path) 201 $result = pwg_query($query); 202 while ( $row=mysql_fetch_assoc($result) ) 209 203 { 210 // only pictures need thumbnails 211 if (in_array(get_extension($path), $conf['picture_ext'])) 212 { 213 $dirname = dirname($path); 214 $filename = basename($path); 215 216 // only files matching the authorized filename pattern can be considered 217 // as "without thumbnail" 218 if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) 219 { 220 continue; 221 } 222 223 // searching the element 224 $filename_wo_ext = get_filename_wo_extension($filename); 225 $tn_ext = ''; 226 $base_test = $dirname.'/thumbnail/'; 227 $base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.'; 228 foreach ($conf['picture_ext'] as $ext) 229 { 230 if (isset($fs['thumbnails'][$base_test.$ext])) 231 { 232 $tn_ext = $ext; 233 break; 234 } 235 } 236 237 if (empty($tn_ext)) 238 { 239 array_push($wo_thumbnails, $path); 240 } 241 } 242 } 204 $basedir = preg_replace('#/*$#', '', $row['galleries_url']); 205 $fs = get_fs($basedir); 206 207 // because isset is one hundred time faster than in_array 208 $fs['thumbnails'] = array_flip($fs['thumbnails']); 209 210 foreach ($fs['elements'] as $path) 211 { 212 // only pictures need thumbnails 213 if (in_array(get_extension($path), $conf['picture_ext'])) 214 { 215 $dirname = dirname($path); 216 $filename = basename($path); 217 218 // only files matching the authorized filename pattern can be considered 219 // as "without thumbnail" 220 if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) 221 { 222 continue; 223 } 224 225 // searching the element 226 $filename_wo_ext = get_filename_wo_extension($filename); 227 $tn_ext = ''; 228 $base_test = $dirname.'/thumbnail/'; 229 $base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.'; 230 foreach ($conf['picture_ext'] as $ext) 231 { 232 if (isset($fs['thumbnails'][$base_test.$ext])) 233 { 234 $tn_ext = $ext; 235 break; 236 } 237 } 238 239 if (empty($tn_ext)) 240 { 241 array_push($wo_thumbnails, $path); 242 } 243 } 244 } // next element 245 } // next site id 243 246 // +-----------------------------------------------------------------------+ 244 247 // | thumbnails creation |
Note: See TracChangeset
for help on using the changeset viewer.