Exemplo n.º 1
0
 public function ckUpload()
 {
     $funcNum = $this->input->get_post('CKEditorFuncNum');
     $thumbimage_config = $this->config->item('thumbimage');
     $widths = $thumbimage_config['thumb_width'];
     // 需要处理的图片宽度尺寸
     $heights = $thumbimage_config['thumb_height'];
     // 需要处理的图片高度尺寸
     $path = '/uploads/ck/';
     $config['upload_path'] = '.' . $path;
     $config['allowed_types'] = 'gif|jpg|png';
     $config['max_size'] = '2048';
     $config['max_width'] = '0';
     $config['max_height'] = '0';
     $config['encrypt_name'] = TRUE;
     //检查并创建目录
     create_folders($config['upload_path']);
     $this->load->library('upload', $config);
     $field_name = "upload";
     if (!$this->upload->do_upload($field_name)) {
         $message = $this->upload->display_errors();
     } else {
         $upload_data = $this->upload->data();
         $url = get_image_url($path . $upload_data['file_name']);
     }
     echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction({$funcNum}, '{$url}', '{$message}');</script>";
 }
Exemplo n.º 2
0
function preUpgrade10000()
{
    $sts = upgrade_folders();
    if ($sts) {
        $sts = create_folders();
    }
    return $sts;
}
Exemplo n.º 3
0
function create_folders($dir)
{
    return is_dir($dir) or create_folders(dirname($dir)) and mkdir($dir, 0777);
}