Example #1
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    global $txpcfg, $img_dir;
    pagetop('image', $message);
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id='{$id}'");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf(gTxt('image_name') . br . fInput('text', 'name', $name, 'edit')) . graf(gTxt('image_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('alt_text') . br . fInput('text', 'alt', $alt, 'edit', '', '', 50)) . graf(gTxt('caption') . br . text_area('caption', '100', '400', $caption)) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save')))), endTable();
    }
}
Example #2
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    global $txpcfg, $img_dir, $file_max_upload_size;
    pagetop(gTxt('edit_image'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $categories = getTree("root", "image");
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($ext != '.swf') {
            $img = '<img src="' . hu . $img_dir . '/' . $id . $ext . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" />';
        } else {
            $img = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . "?{$uDate}" . '" alt="" />';
        } else {
            $thumb = '';
        }
        echo startTable('list'), tr(td($img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', ''))), tr(td(join('', array($thumbnail ? startTable('image-thumbnail') . tr(td($thumb) . td(dLink('image', 'thumbnail_delete', 'id', $id))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', ''))))), check_gd($ext) ? thumb_ui($id) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))), endTable();
    }
}
Example #3
0
function image_edit($message = '', $id = '')
{
    global $txpcfg, $img_dir, $file_max_upload_size, $txp_user, $event;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author == $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        $categories = getTree("root", "image");
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img = '<img class="image fullsize" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" id="image-fullsize" />';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img class="image thumbnail" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="" ' . ($thumb_w ? "width='{$thumb_w}' height='{$thumb_h}'" : '') . ' />';
        } else {
            $thumb = '';
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(pluggable_ui('image_ui', 'image_edit', $img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', 'image-replace'), $rs)), ' class="image-edit' . $aspect . '"'), tr(td(pluggable_ui('image_ui', 'thumbnail_edit', join('', array($thumbnail ? startTable('image-thumbnail', '', 'image-thumbnail') . tr(td($thumb, '', 'thumbwrapper') . td(dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', 'thumbnail-upload'))), $rs)), ' class="thumbnail-edit"'), check_gd($ext) ? thumb_ui($id, $rs) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name'), ' class="name"') . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category'), ' class="category"') . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text'), ' class="alt text"') . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . '<textarea id="caption" name="caption">' . $caption . '</textarea>', ' class="caption description text"') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form')), ' class="image-detail"'), endTable() . n . '</div>';
    }
}
Example #4
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    global $txpcfg, $img_dir, $file_max_upload_size;
    pagetop(gTxt('edit_image'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', ''))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', ''))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))), endTable();
    }
}