本文整理汇总了PHP中SimpleImage::text方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleImage::text方法的具体用法?PHP SimpleImage::text怎么用?PHP SimpleImage::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleImage
的用法示例。
在下文中一共展示了SimpleImage::text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
function user_register_submit()
{
//print_r();
//die;
//if(empty($this->input->post('first_name'))){
$this->form_validation->set_rules('username', 'User Name', 'required|is_unique[users.username]');
$this->form_validation->set_rules('password_new', 'New Password', 'required|trim|min_length[6]|regex_match[#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\W).*$#]');
// strong password include one letter,one number,one CAPS,one symbol
$this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|trim|min_length[8]|matches[password_new]');
$this->form_validation->set_rules('user_email', 'User Email', 'required|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('first_name', 'User First Name', 'required');
$this->form_validation->set_rules('last_name', 'User Last Name', 'required');
$this->form_validation->set_rules('phone', 'User Phone Number', 'required|numeric|xss_clean');
$this->form_validation->set_rules('user_role_id', 'User Type', 'required');
//$this->form_validation->set_rules('user_avatar', 'Image', 'required');
if ($this->form_validation->run() == FALSE) {
//echo validation_errors('<div class="alert alert-danger">', '</div>');
//exit;
}
$data['error_post'] = '';
$data['succ_post'] = '';
$data['error_post'] = validation_errors();
//print_r($data['error_post']);
//echo validation_errors();
//check_exist_country
$chk_count = $this->UserManage_model->check_exist_user();
if ($chk_count > 0) {
$data['error_post'] .= 'User already exists, please check email or username';
}
//check file upload extension
if (!empty($_FILES['user_avatar']['name'])) {
$upload_file = $_FILES['user_avatar']['name'];
$file_ar = explode('.', $upload_file);
$new_file_name = $file_ar[0];
$new_file_ext = $file_ar[1];
$allowed_ext = array('jpg', 'jpeg', 'gif', 'png');
if (!in_array($new_file_ext, $allowed_ext)) {
$data['error_post'] .= 'Upload Error: please upload jpg/jpeg/gif/png';
//array_push($data['error_post'],'Upload Error: please upload jpg/jpeg/gif/png');
}
}
if (empty($data['error_post'])) {
//echo 'submit to register<hr>';
//Upload user avater
if (!empty($_FILES['user_avatar']['name'])) {
$real_site_path = str_replace('system/', '', BASEPATH);
//$dir_folder = $real_site_path . 'media/upload/';
//$dir_folder1 = $real_site_path . 'media/upload/user-avatar/';
$dir_path_thumb = $real_site_path . 'media/upload/user-avatar/thumb_150x150/';
$dir_path = $real_site_path . 'media/upload/user-avatar/';
$upload_file = $_FILES['user_avatar']['name'];
$file_ar = explode('.', $upload_file);
$new_file_name = $file_ar[0];
$new_file_ext = $file_ar[1];
$new_upload_file_thumb = $new_file_name . '_' . time() . "." . $new_file_ext;
$new_upload_file = $new_file_name . '_' . time() . "." . $new_file_ext;
$uploaded_path_thumb = $dir_path_thumb . $new_upload_file_thumb;
$uploaded_path_orig = $dir_path . $new_upload_file;
$new_uploaded_path_orig = $dir_path . $new_upload_file;
$font_path = $real_site_path . 'media/upload/';
//chmod($dir_folder,777);
//chmod($dir_folder1,777);
//chmod($dir_path,777);
//chmod($dir_path_thumb,777);
if (!empty($new_file_name)) {
move_uploaded_file($_FILES['user_avatar']['tmp_name'], $uploaded_path_orig) or die('upload image error...');
$image = new SimpleImage();
$image->load($uploaded_path_orig);
$image->resize(150, 150);
$image->text($this->input->post('username'), $font_path . 'GILSANUB.TTF', 11, '#FFFFFF', 'top', 0, 20);
$image->save($uploaded_path_thumb);
//$image->watermark_text($uploaded_path_orig,$uploaded_path_thumb,$this->input->post('username'),$font_path);
//watermark
//$image_wt = new SimpleImage();
//$image_wt->load($uploaded_path_orig);
//$image->resize(150,150);
//$image_wt->watermark_text($uploaded_path_orig,$uploaded_path_thumb,$this->input->post('username'),$font_path);
//save images data
$image_data = array();
$image_data['user_avatar'] = $new_upload_file;
//die;
}
}
if (!isset($image_data)) {
$image_data = NULL;
}
$ret_query = $this->UserManage_model->insert_data($image_data);
}
if (isset($ret_query)) {
$data_list['query'] = $this->UserManage_model->init();
$data_list['listquery'] = $this->UserManage_model->listUserManage();
redirect("thank-you", "location");
return;
}
$meta_data['seo_title'] = '';
$meta_data['seo_desc'] = '';
$meta_data['seo_keywords'] = '';
$data['first_name'] = $this->input->post('first_name');
$data['last_name'] = $this->input->post('last_name');
$data['user_email'] = $this->input->post('user_email');
//.........这里部分代码省略.........