Ignore:
Timestamp:
Apr 19, 2006, 1:46:53 AM (18 years ago)
Author:
rvelices
Message:

merge r1203 from branch-1_6 into trunk

bug 335: tn_ext, has_high and representative_ext are updated during file
synchronization and not metadata synchronization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_reader_local.php

    r1064 r1204  
    4545{
    4646  global $errors;
    47  
     47
    4848  if (!is_dir($this->site_url))
    4949  {
     
    5555        )
    5656      );
    57    
     57
    5858    return false;
    5959  }
    60  
     60
    6161  return true;
    6262}
     
    7878{
    7979  global $conf;
    80   if (!isset($conf['flip_picture_ext']))
    81   {
    82     $conf['flip_picture_ext'] = array_flip($conf['picture_ext']);
    83   }
    8480  if (!isset($conf['flip_file_ext']))
    8581  {
     
    9894        $filename_wo_ext = get_filename_wo_extension($node);
    9995
    100         // searching the thumbnail
    101         $tn_ext = $this->get_tn_ext($path, $filename_wo_ext);
    102 
    103         if (isset($conf['flip_picture_ext'][$extension]))
     96        if ( isset($conf['flip_file_ext'][$extension]) )
    10497        {
     98          $tn_ext = $this->get_tn_ext($path, $filename_wo_ext);
    10599          $fs[ $path.'/'.$node ] = array(
    106100            'tn_ext' => $tn_ext,
    107             'has_high' => $this->get_has_high($path, $node)
    108101            );
    109102        }
    110         else if (isset($conf['flip_file_ext'][$extension]))
    111         { // file not a picture
    112           $representative_ext = $this->get_representative_ext($path, $filename_wo_ext);
    113 
    114           $fs[ $path.'/'.$node ] = array(
    115             'tn_ext' => $tn_ext,
    116             'representative_ext' => $representative_ext
    117             );
    118         }
    119 
    120103      }
    121104      elseif (is_dir($path.'/'.$node)
     
    141124
    142125// returns the name of the attributes that are supported for
    143 // update/synchronization according to configuration
     126// files update/synchronization
    144127function get_update_attributes()
    145128{
    146   global $conf;
    147  
    148   $update_fields = array(
    149     'has_high', 'representative_ext', 'filesize', 'width', 'height'
    150     );
    151  
     129  return array('tn_ext', 'has_high', 'representative_ext');
     130}
     131
     132function get_element_update_attributes($file)
     133{
     134  global $conf;
     135  $data = array();
     136
     137  $filename = basename($file);
     138  $dirname = dirname($file);
     139  $filename_wo_ext = get_filename_wo_extension($filename);
     140  $extension = get_extension($filename);
     141
     142  $data['tn_ext'] = $this->get_tn_ext($dirname, $filename_wo_ext);
     143  $data['has_high'] = $this->get_has_high($dirname, $filename);
     144
     145  if ( !isset($conf['flip_picture_ext'][$extension]) )
     146  {
     147    $data['representative_ext'] = $this->get_representative_ext(
     148        $dirname, $filename_wo_ext
     149      );
     150  }
     151  return $data;
     152}
     153
     154// returns the name of the attributes that are supported for
     155// metadata update/synchronization according to configuration
     156function get_metadata_attributes()
     157{
     158  global $conf;
     159
     160  $update_fields = array('filesize', 'width', 'height');
     161
    152162  if ($conf['use_exif'])
    153163  {
     
    167177        );
    168178  }
    169  
     179
    170180  return $update_fields;
    171181}
    172182
    173183// returns a hash of attributes (metadata+filesize+width,...) for file
    174 function get_element_update_attributes($file)
     184function get_element_metadata($file)
    175185{
    176186  global $conf;
     
    182192  $data = array();
    183193
    184   $filename = basename($file);
    185  
    186   $data['has_high'] = $this->get_has_high(dirname($file), $filename);
    187  
    188   $data['representative_ext'] = $this->get_representative_ext(
    189     dirname($file),
    190     get_filename_wo_extension($filename)
    191     );
    192 
    193194  $data['filesize'] = floor(filesize($file)/1024);
     195
    194196  if ($image_size = @getimagesize($file))
    195197  {
     
    222224    }
    223225  }
    224  
     226
    225227  return $data;
    226228}
     
    246248{
    247249  global $conf;
    248  
     250
    249251  $base_test =
    250252    $path.'/thumbnail/'.$conf['prefix_thumbnail'].$filename_wo_ext.'.';
    251  
     253
    252254  foreach ($conf['picture_ext'] as $ext)
    253255  {
     
    258260    }
    259261  }
    260  
     262
    261263  return null;
    262264}
     
    268270    return 'true';
    269271  }
    270  
     272
    271273  return null;
    272274}
Note: See TracChangeset for help on using the changeset viewer.