/** * Output Admin * * Returns the field with it's <label> in an <li> suitable for the admin forms. * * @return string $return The HTML to be included in a form */ function output_admin() { $attributes = $this->output_shared(); $this->help = 'Maximum filesize for web upload: ' . setting('upload_max') . '. ' . $this->help; $help = '<div class="help">' . $this->help . '</div>'; // create text that appears after the upload box $after_box = '<input type="button" class="button" onclick="javascript:$(\'#ftp_notes_' . $this->name . '\').modal(); void(0);" name="" value="Upload via FTP" />'; // show current file if (!empty($this->value)) { if (in_array(file_extension($this->value), array('jpg', 'jpeg', 'gif', 'bmp', 'png'))) { $this->CI->load->helper('image_thumb'); $after_box .= '<br /><a href="' . site_url($this->value) . '"><img style="margin-left: 150px" src="' . image_thumb(FCPATH . $this->value, 100, 100) . '" alt="preview" /></a>'; } else { $after_box .= ' <a href="' . site_url($this->value) . '">current file</a>'; } $after_box .= '<br /><input style="margin-left: 150px" type="checkbox" name="delete_file_' . $this->name . '" value="1" /> <span style="font-style: italic; color: #ff6464">Delete current ' . $this->label . '</span>'; } // build HTML // we can track an already-uploaded filename with a hidden field so, if we // don't have a new upload, we stick with the file we already have $return = '<li> <label for="' . $this->name . '">' . $this->label . '</label> <input type="hidden" name="' . $this->name . '_uploaded" value="' . $this->value . '" /> <input type="hidden" name="' . $this->name . '_ftp" value="" /> <input ' . $attributes . ' /> ' . $after_box . ' ' . $help . ' <!-- hidden modal window for assigning FTP filenames --> <div class="modal" style="height:200px" id="ftp_notes_' . $this->name . '"> <script type="text/javascript"> $(document).ready(function() { $(\'input[name="' . $this->name . '_ftp_input"]\').keyup(function () { $(\'input[name="' . $this->name . '_ftp"]\').val($(this).val()); }); }); </script> <h3>Upload File via FTP</h3> <ul class="form"> <li> To upload your file via FTP, follow the directions below: </li> <li> <b>1)</b> Connect to your FTP server with your favourite <a class="tooltip" title="An FTP client, such as \'FileZilla\', is an application you download on your computer that connects to FTP server and uploads/downloads files." href="javascript:void(0)">FTP client</a>. </li> <li> <b>2)</b> Upload your file to <span class="code">' . $this->upload_directory . '</span>. </li> <li> <b>3)</b> Enter your uploaded filename here: <input type="text" name="' . $this->name . '_ftp_input" /> (e.g., "myfile.pdf"). </li> <li> <b>4)</b> Close this window </li> </ul> </div> <!-- end hidden modal window --> </li>'; return $return; }
function preview_image($theme) { $this->CI->load->helper('image_thumb'); // preview file should be here $preview = FCPATH . 'themes/' . $theme . '/preview.jpg'; if (file_exists($preview)) { return image_thumb($preview, 160, 208); } else { $default = FCPATH . 'themes/_common/preview.jpg'; return image_thumb($default, 160, 208); } }
function output($attributes = array()) { $settings = $this->Field->settings; // Image thumbnail size override if (!empty($attributes['width']) || !empty($attributes['height'])) { $max_width = !empty($attributes['width']) ? $attributes['width'] : 0; $max_height = !empty($attributes['height']) ? $attributes['height'] : 0; $crop = isset($attributes['crop']) && str_to_bool($attributes['crop']) ? TRUE : FALSE; $image_src = image_thumb($this->content['src'], $max_width, $max_height, $crop); } else { if (!empty($settings['max_width']) || !empty($settings['max_height'])) { $max_width = !empty($settings['max_width']) ? $settings['max_width'] : 0; $max_height = !empty($settings['max_height']) ? $settings['max_height'] : 0; $crop = isset($settings['crop']) && $settings['crop'] == '1' ? TRUE : FALSE; $image_src = image_thumb($this->content['src'], $max_width, $max_height, $crop); } else { $image_src = base_url($this->content['src']); } } // Show output with image tags if ($settings['output'] == 'image') { // Inline editing callback override if (isset($attributes['editable'])) { if (str_to_bool($attributes['editable'])) { return $this->_inline_editable($image_src, TRUE); } else { return $this->_inline_editable($image_src, FALSE); } } else { if (!isset($settings['inline_editing']) || $settings['inline_editing']) { return $this->_inline_editable($image_src, TRUE); } else { return $this->_inline_editable($image_src, FALSE); } } } else { return $image_src; } }
function DoEditTheme() { $id = $this->Post['id']; if (!$id) { $this->Messager("主题不存在", "admin.php?mod=show&code=modify_theme"); } $theme_arr = jconf::get('theme'); $theme_arr['theme_list'][$id]['theme_bg_color'] = $this->Post['theme_bg_color'] ? $this->Post['theme_bg_color'] : "#2F97CA"; $theme_arr['theme_list'][$id]['theme_link_color'] = $this->Post['theme_link_color'] ? $this->Post['theme_link_color'] : "#0073B2"; $theme_arr['theme_list'][$id]['theme_text_color'] = $this->Post['theme_text_color'] ? $this->Post['theme_text_color'] : "#333333"; $theme_arr['theme_list'][$id]['theme_bg_image_type'] = $this->Post['theme_bg_image_type'] ? $this->Post['theme_bg_image_type'] : "center"; jconf::set('theme', $theme_arr); $config = array(); if ($this->Post['set_system_theme'] == 1) { $config['theme_bg_color'] = $this->Post['theme_bg_color'] ? $this->Post['theme_bg_color'] : '#2F97CA'; $config['theme_bg_image_type'] = $this->Post['theme_bg_image_type'] ? $this->Post['theme_bg_image_type'] : 'center'; $config['theme_id'] = $id; $config['theme_link_color'] = $this->Post['theme_link_color'] ? $this->Post['theme_link_color'] : '#0073B2'; $config['theme_text_color'] = $this->Post['theme_text_color'] ? $this->Post['theme_text_color'] : '#333333'; jconf::update($config); } if ($_FILES['changePic']['name']) { $type = trim(strtolower(end(explode(".", $_FILES['changePic']['name'])))); $themebg = "themebg"; $image_name = $themebg . ".jpg"; $image_path = RELATIVE_ROOT_PATH . './theme/' . $id . '/images/'; $image_file = $image_path . $image_name; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, 'changePic', true); jupload()->setMaxSize(5120); jupload()->setNewName($image_name); $result = jupload()->doUpload(); $themebg_preview = "themebg_preview"; $themebg_preview_name = $themebg_preview . ".jpg"; $themebg_preview_path = RELATIVE_ROOT_PATH . './theme/' . $id . "/"; $image_file_min = $themebg_preview_path . $themebg_preview_name; image_thumb($image_file, $image_file_min, 76, 76); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); unlink($image_file_min); $this->Messager("上传失败", -1); } } $this->Messager("设置成功", "admin.php?mod=show&code=modify_theme"); }
<div style="width: 150px; text-align: center; float: left;"> <a class="choose_image" href="javascript:void(0);" style="display: block; margin-bottom: 5px;"> <img class="image_thumb" src="<?php echo image_thumb(set_value('field_id_' . $Field->id, $content['src']), 150, 150, FALSE, array('no_image_image' => ADMIN_NO_IMAGE)); ?> " /> </a> <a class="remove_image" href="javascript:void(0);">Remove Image</a><br /> <a class="choose_image" href="javascript:void(0);">Add Image</a> <input class="hidden_file" type="hidden" value="<?php echo set_value('field_id_' . $Field->id, $content['src']); ?> " name="<?php echo 'field_id_' . $Field->id; ?> [src]" /> </div> <?php if ($Field->settings['output'] == 'image') { ?> <div style="float: left; margin-left: 15px; width: 220px;"> <label for="alt"><strong>Alternative Text:</strong></label> <input type="text" name="<?php echo 'field_id_' . $Field->id; ?> [alt]" value="<?php echo set_value('field_id_' . $Field->id, $content['alt']); ?>
function upload_icon($upload_data) { extract($upload_data); $u_setting = $this->upload_setting(); $allow_exts = $u_setting['allow_exts']; $max_size = $u_setting['img_size']; $type = trim(strtolower(end(explode(".", $_FILES[$field]['name'])))); if (!in_array($type, $allow_exts)) { return -1; } $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}"; $image_path = $this->qun_avatar_path($upload_data['qid']); if (empty($image_path)) { return; } $image_file = $image_path . $image_name; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $field, true); jupload()->setMaxSize($max_size); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { jio()->DeleteFile($image_file); return -2; } list($w, $h) = getimagesize($image_file); $dst_file = $image_path . $upload_data['qid'] . '_b.jpg'; if (file_exists($dst_file)) { unlink($dst_file); } $make_result = image_thumb($image_file, $dst_file, 80, 80, 2); $lst_file = $image_path . $upload_data['qid'] . '_s.jpg'; if (file_exists($lst_file)) { unlink($lst_file); } $make_result = image_thumb($image_file, $lst_file, 50, 50, 2); unlink($image_file); if ($GLOBALS['_J']['config']['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $lst_file, '', $ftp_key); if ($ftp_result > 0) { $ftp_result = ftpcmd('upload', $dst_file, '', $ftp_key); jio()->DeleteFile($lst_file); jio()->DeleteFile($dst_file); $lst_file = $site_url . '/' . str_replace('./', '', $lst_file); } } if (!empty($upload_data['qid'])) { DB::query("UPDATE " . DB::table('qun') . " SET icon='{$lst_file}' WHERE qid='{$upload_data['qid']}'"); } return 1; }
<!-- header --> <header id="header"> <div class="logo"> <a href="<?php echo site_url('admin'); ?> "> <img src="/img/admin/WebCapitan.png" alt="" width="150" height="30"> </a> </div> <div class="btn_group pull-right"> <div class="login_nfo"> <img src="<?php echo image_thumb('upls/users/' . $user->img, 50, 50); ?> " width="30" height="30"> <span> <?php echo $user->name; ?> </span> </div> <a href="<?php echo site_url('admin/auth/logout');
function DoModify() { $medal_id = jget('medal_id', 'int'); $sql = "SELECT * FROM " . TABLE_PREFIX . 'medal' . " WHERE id='{$medal_id}'"; $query = $this->DatabaseHandler->Query($sql); $medal_info = $query->GetRow(); $error_msg = ''; $field = 'medal'; $datetime = time(); $medal_name = $this->Post['medal_name']; $medal_depict = $this->Post['medal_depict']; $checkvalue = array('type' => $this->Post['type'], 'day' => $this->Post['day'], 'endday' => $this->Post['endday'], 'tagname' => $this->Post['tagname'], 'invite' => $this->Post['invite'], 'fans' => $this->Post['fans'], 'sign' => $this->Post['sign']); $checkvalue = serialize($checkvalue); $medal_name = $this->Post['medal_name']; $medal_depict = $this->Post['medal_depict']; if (empty($_FILES) || !$_FILES[$field]['name']) { $image_file = $medal_info['medal_img']; $image_file_small = $medal_info['medal_img2']; } else { jio()->DeleteFile($medal_info['medal_img']); jio()->DeleteFile($medal_info['medal_img2']); $image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . $datetime . '/'; $image_name = $medal_info['id'] . "_o.jpg"; $image_file = $image_path . $image_name; $image_file_small = $image_path . $medal_info['id'] . "_s.jpg"; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { $this->Messager("上传图片失败", "admin.php?mod=medal"); } makethumb($image_file, $image_file_small, 60, 60, 0, 0, 0, 0, 0, 0); image_thumb($image_file, $image_file, 60, 60); image_thumb($image_file_small, $image_file_small, 60, 60); $image_file = addslashes($image_file); $image_file_small = addslashes($image_file_small); $img = grayJpeg($image_file_small); imagejpeg($img, $image_file_small, 100); imagedestroy($img); } $sql = "update `" . TABLE_PREFIX . "medal` set `medal_img`='{$image_file}' ,`medal_img2` = '{$image_file_small}', `medal_name`='{$medal_name}' ,`medal_depict` = '{$medal_depict}' , `conditions` = '{$checkvalue}' where `id`='" . (int) $this->Post['medal_id'] . "'"; $this->DatabaseHandler->Query($sql); if ($error_msg) { $this->Messager($error_msg); } $this->Messager("编辑成功", 'admin.php?mod=medal'); }
function image_safe_thumb($sourcefile, $id, $ext, $dir1, $forcedwidth, $forcedheight, $randomname = 0) { global $time, $ip; $dir2 = image_set_dir($id, $dir1); $filename = $randomname ? md5(rand(0, 1000000000) . $time . $ip) . $ext : $id . $ext; $filepath = "{$dir1}{$dir2}/{$filename}"; $arr = image_thumb($sourcefile, $filepath, $forcedwidth, $forcedheight); $arr['fileurl'] = "{$dir2}/{$filename}"; return $arr; }
<div> <?php echo form_label('Alternative Text:', 'alt'); ?> <?php echo form_input(array('name' => 'alt', 'value' => set_value('alt', isset($Image->alt) ? $Image->alt : ''))); ?> </div> <div> <?php echo form_label('Image:', 'filename'); ?> <a id="change_image" href="javascript:void(0)"><img id="image" src="<?php echo image_thumb($Image->filename, 100, 100); ?> " /></a> <input type="hidden" value="<?php echo set_value('filename', isset($Image->filename) ? $Image->filename : ''); ?> " name="filename" id="filename" /> </div> <div> <?php echo form_label('Description:', 'description'); ?> <div style="display: inline-block;"> <?php echo form_textarea(array('name' => 'description', 'id' => 'description', 'value' => set_value('description', isset($Image->description) ? $Image->description : '')));
function onLoadPic() { if (!$this->MemberHandler->HasPermission($this->Module, 'create')) { js_alert_output($this->MemberHandler->GetError()); } $id = jget('id', 'int'); $file_name = 'pic' . $id; if (MEMBER_ROLE_TYPE != 'admin' && !$is_allowed) { load::logic('vote'); $VoteLogic = new VoteLogic(); $is_allowed = $VoteLogic->allowedCreate(MEMBER_ID); } if ($is_allowed) { js_alert_output($is_allowed); } if ($_FILES[$file_name]['name']) { $name = time() . MEMBER_ID; $image_name = $name . "_b.jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/vote/'; $image_file = $image_path . $image_name; $image_th_file = $image_path . $name . "_th.jpg"; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $file_name, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); echo "<script language='Javascript'>"; echo "parent.document.getElementById('message').style.display='block';"; echo "parent.document.getElementById('uploading').style.display='none';"; echo "parent.document.getElementById('message').innerHTML='图片上载失败'"; echo "</script>"; exit; } image_thumb($image_file, $image_th_file, 100, 100, 1, 0, 0); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $face_url . '/' . str_replace('./', '', $image_file); } $ftp_result = ftpcmd('upload', $image_th_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_th_file); $image_th_file = $face_url . '/' . str_replace('./', '', $image_th_file); } } #插入数据库 $image_id = $this->VoteLogic->insert_vote_img(MEMBER_ID, $image_th_file, $image_file); echo "<script language='Javascript'>"; echo "parent.document.getElementById('pic_show_{$id}').src='{$image_th_file}';"; echo "parent.document.getElementById('pic_id_{$id}').value='{$image_id}';"; echo "</script>"; exit; } }
function _uploadImage() { $field = 'author'; $type = trim(strtolower(end(explode(".", $_FILES[$field]['name'])))); if ($type != 'gif' && $type != 'jpg' && $type != 'png') { Mobile::error('Illegal Strings', 350); } $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}"; $sub_path = './cache/temp_images/' . $image_name[0] . '/'; $image_path = RELATIVE_ROOT_PATH . $sub_path; $image_path_abs = ROOT_PATH . $sub_path; $image_file = $image_path . $image_name; $image_file_abs = $image_path_abs . $image_name; if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } jupload()->init($image_path_abs, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file_abs); } if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 352); } list($w, $h) = getimagesize($image_file_abs); if ($w > 601) { $tow = 599; $toh = round($tow * ($h / $w)); $result = makethumb($image_file_abs, $image_file_abs, $tow, $toh); if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 351); } } $up_image_path = addslashes($image_file_abs); $src_file = $image_file_abs; $image_path = RELATIVE_ROOT_PATH . 'images/face/' . face_path(MEMBER_ID); $image_path_abs = ROOT_PATH . './images/face/' . face_path(MEMBER_ID); if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } $image_file = $dst_file = $image_path . MEMBER_ID . '_b.jpg'; $image_file_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_b.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 128, 128, 2); $image_file_small = $dst_file = $image_path . MEMBER_ID . '_s.jpg'; $image_file_small_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_s.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 50, 50, 2); $face_url = ''; if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file_abs, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_small_abs, '', $ftp_key); jio()->DeleteFile($image_file_abs); jio()->DeleteFile($image_file_small_abs); } } $sql = "update `" . TABLE_PREFIX . "members` set `face_url`='{$face_url}', `face`='{$dst_file}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); jio()->DeleteFile($src_file); if ($this->Config['extcredits_enable'] && MEMBER_ID > 0) { update_credits_by_action('face', MEMBER_ID); } Mobile::success("Success"); }
function uploadPic($field, $category_pic_id) { $image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . face_path($category_pic_id); $image_name = $category_pic_id . "_o.gif"; $image_file = $image_path . $image_name; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { return array('err' => '图片上传失败'); } makethumb($image_file, 16, 16, 0, 0, 0, 0, 0, 0); image_thumb($image_file, $image_file, 16, 16); $image_file = addslashes($image_file); return $image_file; }
public function do_setting() { $wechat = $this->Post['wechat']; $diy_key = $this->Post['diy_key']; $diy_reply = $this->Post['diy_reply']; $delete = $this->Post['delete']; $wechat_conf = jconf::get("wechat"); if ($_FILES['qrcode']['name']) { $image_name = "my_wechat_qrcode.jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/'; $image_file = $image_path . $image_name; jupload()->init($image_path, 'qrcode', true); jupload()->setMaxSize(512); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); } image_thumb($image_file, $image_file, 150, 150); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $site_url . '/' . str_replace('./', '', $image_file); } } $wechat['my_qrcode'] = $image_file; } else { $wechat['my_qrcode'] = $wechat_conf['my_qrcode']; } $wechat['help_key'] = explode('|', $wechat['help_key']); $wechat['bind_key'] = explode('|', $wechat['bind_key']); $wechat['3g_key'] = explode('|', $wechat['3g_key']); $wechat['wap_key'] = explode('|', $wechat['wap_key']); if ($diy_key && $diy_reply) { $wechat['diy_reply']['diy_key'][] = $diy_key; $temp_key = array_search($diy_key, $wechat['diy_reply']['diy_key']); $wechat['diy_reply']['diy_reply'][$temp_key] = $diy_reply; } if (is_array($delete)) { foreach ($delete as $diy_key_del) { if ($wechat['diy_reply']['diy_key'][$diy_key_del]) { unset($wechat['diy_reply']['diy_key'][$diy_key_del]); } if ($wechat['diy_reply']['diy_reply'][$diy_key_del]) { unset($wechat['diy_reply']['diy_reply'][$diy_key_del]); } } } if ($wechat['on'] && !$wechat['token']) { $this->Messager("开启微信必须设置Token"); } else { $r = jconf::update("wechat_enable", $wechat['on']); $r = jconf::update("wechat_qrcode", $wechat['my_qrcode']); $r = jconf::update("my_wechat", $wechat['mywechat']); $r = jconf::set("wechat", $wechat); $this->Messager("设置成功!"); } }
<td class="center"><input type="checkbox" value="<?php echo $Image->id; ?> " name="selected[]" /></td> <td><?php echo $Image->title; ?> <?php if ($Image->hide) { ?> (Hidden)<?php } ?> </td> <td><img src="<?php echo image_thumb($Image->filename, 50, 50, true); ?> " /></td> <td class="right">[ <a href="<?php echo site_url(ADMIN_PATH . '/galleries/images/edit/' . $Image->id); ?> ">Edit</a> ]</td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="5" class="center">No images have been added.</td>
} ?> <div id="label-pad"> <h3>BEACH NEWS</h3> <div class="add_story_link"> <a href="/node/add/beach-news">Submit Story</a> </div> </div> <div class="beach-news-block"> <ul class="unstyled"> <?php foreach ($nid_news as $key => $value) { ?> <li> <div class="beach_news_inner"> <img src="<?php echo base_url() . image_thumb($filename[$key], 0, $filepath[$key], 'news', '60x70'); ?> " /> <div class="news_block_title"> <span> <a href="/node/<?php echo $value; ?> "><?php echo $title_news[$key]; ?> </a> <?php echo date('m/d', $time[$key]); ?> </span>
$action_link['text'] = '返回列表'; $is_show = 1; include_once 'article_info.php'; break; case 'insert': if (0 === $_FILES['image']['error']) { $image_url = upload_file($_FILES['image'], '../images/' . date('Ym')); $_POST['cover_image'] = substr(image_thumb($image_url, 130, 90), 3); } $db->insert($table, $_POST); echo "<script>if(confirm('继续添加?')){window.location='?act=add&cat_id={$cat_id}';} else { window.location = '?act=list';}</script>"; break; case 'update': if (0 === $_FILES['image']['error']) { $image_url = upload_file($_FILES['image'], '../images/' . date('Ym')); $_POST['cover_image'] = substr(image_thumb($image_url, 130, 90), 3); } $db->update($table, $_POST, array('article_id' => $article_id)); echo "<script>alert('编辑成功!'); window.location = '?act=list';</script>"; break; case 'edit': $form_act = 'update'; $ur_here = '编辑文章'; $action_link['href'] = '?act=list'; $action_link['text'] = '返回列表'; extract($db->get_one("SELECT * FROM {$table} WHERE article_id = ?", array($article_id))); include_once 'article_info.php'; break; case 'del': $db->execute("DELETE FROM {$table} WHERE article_id = ?", array($article_id)); echo "<script>alert('删除成功!'); window.location = '{$_SERVER[HTTP_REFERER]}';</script>";
</div> <div style="float: left; width: 70%;"> <? if (!empty($gallery['images'])) { ?> <div class="gallery_images"> <ul class="image_gallery" rel="<?php echo site_url('admincp/gallery/save_image_order/' . $gallery['id']); ?> "> <? foreach ($gallery['images'] as $image) { ?> <li id="image_<?php echo $image['id']; ?> "> <? if ($image['featured'] == TRUE) { ?><span class="featured">Featured</span><? } ?> <img src="<?php echo image_thumb($image['path'], 100, 100); ?> " alt="image" /> <a class="move" href="#"><img src="<?php echo branded_include('images/arrow.png'); ?> " title="drag to re-order" /></a> <? if ($image['featured'] == FALSE) { ?><a class="feature" href="<?php echo site_url('admincp/gallery/image_feature/' . $gallery['id'] . '/' . $image['id']); ?> "><img src="<?php echo branded_include('images/star.png'); ?> " title="make featured image" /></a><? } ?> <a class="delete" href="<?php echo site_url('admincp/gallery/image_delete/' . $gallery['id'] . '/' . $image['id']);
function addPrize() { $id = (int) $this->Get['id']; $file = 'image_' . $id; if ($_FILES[$file]['name']) { $name = time(); $image_name = $name . MEMBER_ID . ".jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/reward/' . face_path(MEMBER_ID); $image_file = $image_path . $image_name; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $file, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); echo "<script type='text/javascript'>"; echo "parent.document.getElementById('message').style.display='none';"; echo "</script>"; $this->_image_error(jupload()->_error); exit; } image_thumb($image_file, $image_file, 100, 100); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $site_url . '/' . str_replace('./', '', $image_file); } } DB::query("insert into `" . TABLE_PREFIX . "reward_image` set `uid` = '" . MEMBER_ID . "',`image` = '{$image_file}' "); $image_id = DB::insert_id(); } else { echo "<script type='text/javascript'>"; echo "alert('没有图片');"; echo "</script>"; exit; } echo "<script type='text/javascript'>"; echo "parent.document.getElementById('message').style.display='none';"; echo "parent.document.getElementById('show_image_{$id}').src='{$image_file}';"; echo "parent.document.getElementById('show_image_{$id}').style.display='block';"; echo "parent.document.getElementById('hid_image_{$id}').value='{$image_id}';"; echo "</script>"; exit; }
function onloadPic() { if (!$this->MemberHandler->HasPermission($this->Module, 'create')) { js_alert_showmsg($this->MemberHandler->GetError()); } if ('admin' != MEMBER_ROLE_TYPE) { $is_allowed = jlogic('event')->allowedCreate(MEMBER_ID, $this->Member); if ($is_allowed) { js_alert_showmsg($is_allowed); } } if ($_FILES['pic']['name']) { $name = time() . MEMBER_ID; $image_name = $name . "_b.jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/event/'; $image_file = $image_path . $image_name; $image_name_show = $name . "_s.jpg"; $image_file_min = $image_path . $image_name_show; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, 'pic', true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); unlink($image_file_min); echo "<script language='Javascript'>"; echo "parent.document.getElementById('message').style.display='block';"; echo "parent.document.getElementById('uploading').style.display='none';"; if ($this->Post['top'] == 'top') { echo "parent.document.getElementById('back1').style.display='block';"; echo "parent.document.getElementById('next3').style.display='block';"; } echo "parent.document.getElementById('message').innerHTML='图片上载失败'"; echo "</script>"; exit; } makethumb($image_file, $image_file_min, 60, 60, 0, 0, 0, 0, 0, 0); image_thumb($image_file, $image_file, 100, 128, 1, 0, 0); if ($this->Config['watermark_enable']) { jlogic('image')->watermark($image_file); } if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_min, '', $ftp_key); jio()->DeleteFile($image_file); jio()->DeleteFile($image_file_min); $image_file = $site_url . '/' . str_replace('./', '', $image_file); } } $hid_pic = $this->Post['hid_pic']; $eid = (int) $this->Post['id']; $this->doUnlink($hid_pic, $eid); echo "<script language='Javascript'>"; echo "parent.document.getElementById('uploading').style.display='none';"; if ($this->Post['top'] == 'top') { echo "parent.document.getElementById('back1').style.display='block';"; echo "parent.document.getElementById('next3').style.display='block';"; } echo "parent.document.getElementById('message').style.display='none';"; echo "parent.document.getElementById('img').style.display='block';"; echo "parent.document.getElementById('showimg').src='{$image_file}';"; echo "parent.document.getElementById('hid_pic').value='{$image_file}';"; echo "</script>"; exit; } }
} if (isset($_REQUEST['file'])) { $from_name = urldecode($_REQUEST['file']); } if (isset($_REQUEST['dest'])) { $to_name = urldecode($_REQUEST['dest']); } if (isset($_REQUEST['quality'])) { $image_quality = intval($_REQUEST['quality']); } if (isset($_REQUEST['t'])) { $image_type = intval($_REQUEST['t']); } if (isset($_REQUEST['sizex'])) { $max_x = intval($_REQUEST['sizex']); } if (isset($_REQUEST['sizey'])) { $max_y = intval($_REQUEST['sizey']); } if (isset($_REQUEST['size'])) { $max_x = intval($_REQUEST['size']); } ini_set('memory_limit', '-1'); //echo $images_folder.$from_name;//exit; //$this->Image->GenerateThumbFile($images_folder.$from_name, $to_name,$max_x,$max_y); $image = new ImageComponent(); //print $images_folder.$from_name.'---'.$to_name.'----'.$max_x.'---'.$max_y.'----'.$from_name;exit; $image->GenerateThumbFile($images_folder . $from_name, $to_name, $max_x, $max_y, $from_name); } image_thumb();
function create_thumb() { if (!is_ajax()) { return show_404(); } if ($this->input->post('image_path')) { echo image_thumb($this->input->post('image_path'), 150, 150, FALSE, array('no_image_image' => ADMIN_NO_IMAGE)); } }
public function modify_left_icon() { $key = $this->Get['key']; $group = $this->Get['group']; $name = $this->Get['name']; $file = $key; $slide = $this->Post['slide']; if ($_FILES[$file]['name']) { $image_name = dir_safe($key) . ".jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/lefticon/'; $image_file = $image_path . $image_name; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $file, true); jupload()->setMaxSize(512); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { $this->_js_output('alert("图片上传失败");'); } image_thumb($image_file, $image_file, 100, 100); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $site_url . '/' . str_replace('./', '', $image_file); } } } else { echo "<script type='text/javascript'>"; echo "alert('没有图片');"; echo "</script>"; exit; } $slide_config = jconf::get('left_navigation'); foreach ($slide_config[$group] as &$v) { if ($v['code'] == $name) { $v['icon'] = $image_file; } } jconf::set('left_navigation', $slide_config); echo "<script type='text/javascript'>"; echo "parent.document.getElementById('show_image_{$key}').src='{$image_file}';"; echo "parent.document.getElementById('show_image_{$key}').style.display='block';"; echo "parent.document.getElementById('show_image_{$key}_value').value='{$image_file}';"; echo "parent.document.location.reload();"; echo "</script>"; exit; }
function smarty_function_thumbnail($params, $smarty) { $smarty->CI->load->helper('image_thumb'); return image_thumb($params['path'], isset($params['height']) ? $params['height'] : FALSE, isset($params['width']) ? $params['width'] : FALSE); }
function create_thumb() { if (is_ajax()) { if ($this->input->post('image_path')) { echo image_thumb($this->input->post('image_path'), 100, 100); } } else { return show_404(); } }
if ($isimage && $conf['tietuku_on']) { include './plugin/xn_tietuku/tietuku.func.php'; $tmpfile = tempnam($conf['tmp_path'], 'tmp_'); file_put_contents($tmpfile, $data); $r = tietuku_upload_file($tmpfile); $r === FALSE and message($errno, $errstr); unlink($tmpfile); message(0, array('url' => $r['linkurl'], 'name' => $name, 'width' => $r['width'], 'height' => $r['height'])); } $day = date('Ymd', $time); $path = $conf['upload_path'] . 'attach/' . $day; $url = $conf['upload_url'] . 'attach/' . $day; !IN_SAE and !is_dir($path) and (mkdir($path, 0777, TRUE) or message(-2, '目录创建失败')); $savename = $uid . '_' . attach_safe_name($name, $allowtypes); $destfile = $path . '/' . $savename; $desturl = $url . '/' . $savename; attach_create(array('tid' => $tid, 'pid' => 0, 'uid' => $uid, 'filesize' => $size, 'width' => $width, 'height' => $height, 'filename' => $day . '/' . $savename, 'filetype' => $type, 'orgfilename' => $name, 'create_date' => $time, 'comment' => '', 'downloads' => '0', 'isimage' => $isimage)) or message(-1, '保存附件数据失败'); file_put_contents($destfile, $data) or message(-1, '写入文件失败'); $ext = file_ext($destfile); if ($width > 0 && $ext != 'gif') { image_thumb($destfile, $destfile, $width, $height); } $conf['ipaccess_on'] and ipaccess_inc($longip, 'attachs'); $conf['ipaccess_on'] and ipaccess_inc($longip, 'attachsizes', $size); if ($ext == 'gif') { list($width, $height, $type, $attr) = getimagesize($destfile); } message(0, array('url' => $desturl, 'name' => $name, 'width' => $width, 'height' => $height)); } else { message(-1, '没有此功能'); }
public function image_thumb() { return image_thumb($this->attribute('image'), $this->attribute('width', 0), $this->attribute('height', 0), $this->attribute('crop', FALSE)); }