function imagepicker_image_select in Image Picker 5.2
Same name and namespace in other branches
- 5 imagepicker.module \imagepicker_image_select()
- 6.2 imagepicker.functions.inc \imagepicker_image_select()
- 7 imagepicker.functions.inc \imagepicker_image_select()
2 calls to imagepicker_image_select()
File
- ./
imagepicker.module, line 638 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function imagepicker_image_select($img_id, $showgroup = TRUE, $public = FALSE, $account = FALSE) {
if ($account) {
$user = $account;
}
else {
global $user;
}
$img = _imagepicker_get_img($img_id, $public ? FALSE : TRUE);
if ($img) {
drupal_add_js(imagepicker_js($img, $public), 'inline');
$imgpath = imagepicker_get_image_path($img, 'browser', $public ? array(
'name' => $img['name'],
'uid' => $img['uid'],
) : FALSE);
$content = '<div class="imgp_help">' . t('Choose the settings you want, place the cursor in the Body box above and Insert image.') . '</div>';
if ($img['img_title']) {
$content .= '<div id="imgp_img_holder_title">' . check_plain($img['img_title']) . '</div>';
}
if ($img['img_description']) {
$content .= '<div id="imgp_img_holder_description">' . $img['img_description'] . '</div>';
}
$content .= '<div id="imgp_img_holder">';
$content .= '<img id="imgp_img" src="' . $imgpath . '" alt="' . check_plain($img['img_title']) . '" title="' . $img['img_name'] . '" />';
$content .= '</div>';
if ($user->uid == $img['uid'] || $public) {
$content .= drupal_get_form('imagepicker_image_form', $img['img_id'], $public);
}
// groups
if (_imagepicker_has_groups() && $showgroup) {
$content .= drupal_get_form('imagepicker_group_images_form', $img['img_id']);
}
}
else {
drupal_set_message(t('Image not found.'), 'error');
$content = '';
}
theme('imagepicker', $content);
}