Changeset 17679


Ignore:
Timestamp:
Aug 31, 2012, 3:34:16 PM (8 years ago)
Author:
plg
Message:

compatible with Piwigo 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/virtualize/admin.php

    r16319 r17679  
    4646    path AS oldpath,
    4747    date_available,
    48     has_high,
    49     tn_ext,
    5048    id
    5149  FROM '.IMAGES_TABLE.'
     
    5654  {
    5755    $file_for_md5sum  = $row['oldpath'];
    58     if ('true' == $row['has_high'])
    59     {
    60       $file_for_md5sum = dirname($row['oldpath']).'/pwg_high/'.basename($row['oldpath']);
    61     }
    6256    $md5sum = md5_file($file_for_md5sum);
    6357
     
    7872
    7973    $extension = get_extension($row['oldpath']);
    80     if (in_array($extension, array('vimeo', 'ytube', 'dm')))
    81     {
    82       $newfilename = basename($row['oldpath']);
    83     }
    84     else
    85     {
    86       $newfilename = $year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8).'.jpg';
    87     }
     74    $newfilename = $year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8).'.jpg';
    8875
    8976    $newpath = $upload_dir.'/'.$newfilename;
     
    9885
    9986    rename($row['oldpath'], $newpath);
    100 
    101     # high definition
    102     if ('true' == $row['has_high'])
    103     {
    104       $high_dir = $upload_dir.'/pwg_high';
    105      
    106       if (!is_dir($high_dir))
    107       {
    108         umask(0000);
    109         $recursive = true;
    110         if (!@mkdir($high_dir, 0777, $recursive))
    111         {
    112           echo 'error during "'.$high_dir.'" directory creation';
    113           exit();
    114         }
    115       }
    116      
    117       rename(
    118         dirname($row['oldpath']).'/pwg_high/'.basename($row['oldpath']),
    119         $high_dir.'/'.$newfilename
    120         );
    121     }
    122 
    123     # thumbnail
    124     if (!empty($row['tn_ext']))
    125     {
    126       $tn_dir = $upload_dir.'/thumbnail';
    127      
    128       if (!is_dir($tn_dir))
    129       {
    130         umask(0000);
    131         $recursive = true;
    132         if (!@mkdir($tn_dir, 0777, $recursive))
    133         {
    134           echo 'error during "'.$tn_dir.'" directory creation';
    135           exit();
    136         }
    137       }
    138      
    139       $tn_oldname = $conf['prefix_thumbnail'];
    140       $tn_oldname.= get_filename_wo_extension(basename($row['oldpath']));
    141       $tn_oldname.= '.'.$row['tn_ext'];
    142      
    143       rename(
    144         dirname($row['oldpath']).'/thumbnail/'.$tn_oldname,
    145         $tn_dir.'/'.$conf['prefix_thumbnail'].get_filename_wo_extension(basename($newfilename)).'.jpg'
    146         );
    147     }
    148     // break;
     87    delete_element_derivatives(array('path' => $row['oldpath']));
    14988  }
    15089
     
    15493;';
    15594  pwg_query($query);
     95
     96  array_push($page['infos'], l10n('Information data registered in database'));
    15697}
    15798
Note: See TracChangeset for help on using the changeset viewer.