Changeset 13083


Ignore:
Timestamp:
Feb 10, 2012, 4:31:42 PM (13 years ago)
Author:
plg
Message:

feature 2566 added: pwg.images.add can perform an update on an existing photo.
The additional parameter is image_id and it can be used only combined with
option resize=1.

Location:
branches/2.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/include/ws_functions.inc.php

    r12809 r13083  
    16611661  {
    16621662    ws_logfile('[pwg.images.add] resize activated');
     1663
     1664    // updating a photo is possible only combined with the resize option
     1665    $params['image_id'] = (int)$params['image_id'];
     1666    if ($params['image_id'] > 0)
     1667    {
     1668      include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     1669     
     1670      $query='
     1671SELECT *
     1672  FROM '.IMAGES_TABLE.'
     1673  WHERE id = '.$params['image_id'].'
     1674;';
     1675     
     1676      $image_row = pwg_db_fetch_assoc(pwg_query($query));
     1677      if ($image_row == null)
     1678      {
     1679        return new PwgError(404, "image_id not found");
     1680      }
     1681    }
    16631682   
    16641683    // temporary file path
     
    16731692    $image_id = add_uploaded_file(
    16741693      $file_path,
    1675       $params['original_filename']
     1694      $params['original_filename'],
     1695      null,
     1696      null,
     1697      $params['image_id'] > 0 ? $params['image_id'] : null
    16761698      );
    16771699
  • branches/2.3/ws.php

    r12729 r13083  
    243243      'resize' => array('default' => false),
    244244      'check_uniqueness' => array('default' => true),
     245      'image_id' => array('default' => null),
    245246      ),
    246247    'POST method only.
Note: See TracChangeset for help on using the changeset viewer.