You are here

function _photos_edit_page_single_image in Album Photos 7.3

Album image management page.

1 string reference to '_photos_edit_page_single_image'
photos_menu in ./photos.module
Implements hook_menu().

File

inc/photos.edit.inc, line 682
Handles uploading and editing images.

Code

function _photos_edit_page_single_image($fid) {
  $output = '';
  $images = array();
  $query = db_select('file_managed', 'f');
  $query
    ->join('photos_image', 'p', 'p.fid = f.fid');
  $query
    ->join('users', 'u', 'f.uid = u.uid');
  $query
    ->fields('f', array(
    'uri',
    'filemime',
    'timestamp',
    'filename',
    'filesize',
  ));
  $query
    ->fields('p');
  $query
    ->fields('u', array(
    'uid',
    'name',
  ));
  $query
    ->condition('f.fid', $fid);
  $result = $query
    ->execute();
  foreach ($result as $data) {
    $images[] = photos_get_info(0, $data);
  }
  if (isset($images[0]->fid)) {
    $node = node_load($images[0]->pid);
    $images[0]->info = array(
      'cover' => $node->album['cover'],
      'pid' => $node->nid,
      'title' => $node->title,
      'uid' => $node->uid,
    );
    $edit_form = drupal_get_form('photos_editlist_form', $images);
    $output .= drupal_render($edit_form);
  }
  if (module_exists('colorbox')) {

    // Display in modal colorbox.
    print $output;
  }
  else {

    // Full page.
    return $output;
  }
}