Changeset 7275


Ignore:
Timestamp:
Oct 19, 2010, 10:29:29 AM (14 years ago)
Author:
plg
Message:

improvement: pwg.images.addSimple returns image_id and a valid URL to show the uploaded photo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pwg_images_addSimple/main.inc.php

    r6697 r7275  
    3333        'maxValue' => $conf['available_permission_levels']
    3434        ),
     35      'tags' => array('default' => null),
    3536      ),
    3637    'POST method only.<br>Use the <b>image</b> field for uploading file.<br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category.'
     
    99100
    100101
    101   if (isset($params['tags']))
     102  if (isset($params['tags']) and !empty($params['tags']))
    102103  {
    103104    $tag_ids = array();
     
    111112    add_tags($tag_ids, array($image_id));
    112113  }
     114
     115  $query = '
     116SELECT id, name, permalink
     117  FROM '.CATEGORIES_TABLE.'
     118  WHERE id = '.$params['category'].'
     119;';
     120  $result = pwg_query($query);
     121  $category = pwg_db_fetch_assoc($result);
     122
     123  return array(
     124    'image_id' => $image_id,
     125    'url' => make_picture_url(
     126      array(
     127        'image_id' => $image_id,
     128        'section' => 'categories',
     129        'category' => $category
     130        )
     131      ),
     132    );
    113133}
    114134?>
Note: See TracChangeset for help on using the changeset viewer.