Changeset 12906 for trunk/admin/include


Ignore:
Timestamp:
Jan 17, 2012, 1:11:14 AM (12 years ago)
Author:
plg
Message:

feature 2548 (multiple sizes): adapt the web API method pwg.images.add (used
by pLoader, Digikam, Lightroom, iPhoto), pwg.images.checkFiles (pLoader only).

The "resize" parameter was removed for pwg.images.add since this behavior
becomes the default behavior in Piwigo 2.4.

Just like pwg.images.addSimple, pwg.images.add now uses the add_uploaded_file
function (next step is to merge pwg.images.add and pwg.images.addSimple)

Location:
trunk/admin/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r12875 r12906  
    23082308  }
    23092309}
     2310
     2311function delete_element_derivatives($ids)
     2312{
     2313  // todo
     2314  if (!is_array($ids))
     2315  {
     2316    $ids = array($ids);
     2317  }
     2318
     2319  // for now I do a massive clear, to be removed once the function is
     2320  // properly implemented
     2321  clear_derivative_cache();
     2322}
    23102323?>
  • trunk/admin/include/functions_upload.inc.php

    r12879 r12906  
    151151}
    152152
    153 function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null, $image_id=null)
     153function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null, $image_id=null, $original_md5sum=null)
    154154{
    155155  // 1) move uploaded file to upload/2010/01/22/20100122003814-449ada00.jpg
     
    164164  global $conf, $user;
    165165
    166   $md5sum = md5_file($source_filepath);
     166  if (isset($original_md5sum))
     167  {
     168    $md5sum = $original_md5sum;
     169  }
     170  else
     171  {
     172    $md5sum = md5_file($source_filepath);
     173  }
     174 
    167175  $file_path = null;
    168176 
     
    235243  else
    236244  {
    237     copy($source_filepath, $file_path);
     245    rename($source_filepath, $file_path);
    238246  }
    239247
     
    292300      'file' => pwg_db_real_escape_string(isset($original_filename) ? $original_filename : basename($file_path)),
    293301      'date_available' => $dbnow,
    294       'tn_ext' => 'jpg',
    295302      'path' => preg_replace('#^'.preg_quote(PHPWG_ROOT_PATH).'#', '', $file_path),
    296303      'filesize' => $file_infos['filesize'],
     
    300307      'added_by' => $user['id'],
    301308      );
    302 
    303     if (isset($high_infos))
    304     {
    305       $insert['has_high'] = 'true';
    306       $insert['high_filesize'] = $high_infos['filesize'];
    307       $insert['high_width'] = $high_infos['width'];
    308       $insert['high_height'] = $high_infos['height'];
    309     }
    310 
     309   
    311310    if (isset($level))
    312311    {
Note: See TracChangeset for help on using the changeset viewer.