Ignore:
Timestamp:
Feb 14, 2007, 1:36:34 AM (17 years ago)
Author:
rvelices
Message:
  • 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/thumbnail.php

    r1635 r1814  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     8// | file          : $Id$
    99// | last update   : $Date$
    1010// | last modifier : $Author$
     
    193193$thumbnalized = array();
    194194
     195
    195196// what is the directory to search in ?
    196197$query = '
    197 SELECT galleries_url
    198   FROM '.SITES_TABLE.'
    199   WHERE id = 1
     198SELECT galleries_url FROM '.SITES_TABLE.'
     199  WHERE galleries_url NOT LIKE "http://%"
    200200;';
    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);
     202while ( $row=mysql_fetch_assoc($result) )
    209203{
    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
    243246// +-----------------------------------------------------------------------+
    244247// |                         thumbnails creation                           |
Note: See TracChangeset for help on using the changeset viewer.