You are here

function imagepicker_user_view_public in Image Picker 5.2

Same name and namespace in other branches
  1. 6.2 imagepicker.user.inc \imagepicker_user_view_public()
  2. 7 imagepicker.user.inc \imagepicker_user_view_public()
1 call to imagepicker_user_view_public()
imagepicker_user_page in ./imagepicker.module
Account functions

File

./imagepicker.module, line 2022
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_user_view_public($img_id) {
  $img = _imagepicker_get_img($img_id, FALSE);
  if ($img) {
    $result = db_query("SELECT name FROM {users} WHERE uid=%d AND status=1", array(
      $img['uid'],
    ));
    $row = db_fetch_array($result);
    $img['name'] = $row['name'] ? $row['name'] : FALSE;
    $imgpath = imagepicker_get_image_path($img, 'full', array(
      'name' => $img['name'],
      'uid' => $img['uid'],
    ));
    $info = image_get_info(imagepicker_get_path(FALSE, array(
      'name' => $img['name'],
      'uid' => $img['uid'],
    )) . $img['img_name']);
    $content = _imagepicker_view_content($img, $imgpath, $info);
  }
  else {
    drupal_set_message(t('Image not found.'), 'error');
    $content = '';
  }
  return $content;
}