public function optProjectMember()
 {
     $projectMemberModel = D('ProjectMember');
     if (I("post.project_id") && I("post.mem_name")) {
         if (I('post.mem_id')) {
             $mem_id = I("post.mem_id");
             $data = $projectMemberModel->create();
             if (I("post.mem_picture") !== I("post.old_img_url")) {
                 $data['mem_picture'] = cutImage(I('post.mem_picture'), UPLOAD_ROOT . C('UPLOAD2DIR') . '/user_' . $this->user_id . '/project/' . I("post.project_id") . '/mem_pictures/', time() . ".jpg", ['x1' => round(I("post.x1")), 'y1' => round(I("post.y1")), 'w' => round(I("post.w")), 'h' => round(I("post.h"))], ['w' => 200, 'h' => 200]);
             }
             if ($projectMemberModel->where(['mem_id' => $mem_id])->save($data) === FALSE) {
                 echo 'error';
                 exit;
             }
         } else {
             $data = $projectMemberModel->create();
             $data['mem_picture'] = cutImage(I('post.mem_picture'), UPLOAD_ROOT . C('UPLOAD2DIR') . '/user_' . $this->user_id . '/project/' . I("post.project_id") . '/mem_pictures/', time() . ".jpg", ['x1' => round(I("post.x1")), 'y1' => round(I("post.y1")), 'w' => round(I("post.w")), 'h' => round(I("post.h"))], ['w' => 200, 'h' => 200]);
             if ($mem_id = $projectMemberModel->data($data)->add()) {
                 // dump($data);
             } else {
                 echo 'error';
                 exit;
             }
         }
     } else {
         echo "非法访问";
     }
     $this->getProject(['Base', 'Member']);
     $projectDetail = $this->projectDetail;
     $this->assign("projectDetail", $projectDetail);
     $project_members = $projectDetail[0]['project_members'];
     foreach ($project_members as $k => $v) {
         if ($v['mem_id'] == $mem_id) {
             $x[0] = $v;
         }
     }
     $project_members = $x;
     $this->assign("project_members", $project_members);
     $this->display("Template:projectMemberList");
     exit;
 }
Example #2
0
$file_tmp_name = isset($_FILES["file"]["tmp_name"]) ? $_FILES["file"]["tmp_name"] : "";
$file_error = isset($_FILES["file"]["error"]) ? $_FILES["file"]["error"] : "";
if (isset($p_upload)) {
    if (!empty($file_name)) {
        if ($file_type == "image/jpeg") {
            if ($file_error > 0) {
                $warning[] = "Fehler beim Uploaden des Bildes (Error: {$file_error})";
            } else {
                if (file_exists($image_path . $file_name)) {
                    unlink($image_path . $file_name);
                }
                move_uploaded_file($file_tmp_name, $image_path . $file_name);
                $parts = explode('.', $file_name);
                $endung = array_pop($parts);
                $name = join('.', $parts);
                if (!cutImage($image_path . $name, $image_path . $type, $save_name, $width, $height)) {
                    $warning[] = "Das Bild muss mind. 200 Pixel breit sein";
                } else {
                    $bestaetigung = "Das Bild <b>{$file_name}</b> wurde erfolgreich hochgeladen";
                }
            }
        } else {
            $warning[] = "Nur Bilder des Typs 'jpg' gültig";
        }
    } else {
        $warning[] = "Sie müssen ein Bild ausgewählt haben";
    }
}
if ($isUserImage) {
    $output .= getH2("Profilbild wechseln");
} else {
Example #3
0
 public function test6data()
 {
     if (IS_POST) {
         echo cutImage(I("post.img_url"), UPLOAD_ROOT . C('UPLOAD2DIR') . "/test/", time() . ".jpg", ['x1' => round(I("post.x1")), 'y1' => round(I("post.y1")), 'w' => round(I("post.w")), 'h' => round(I("post.h"))], ['w' => 200, 'h' => 200]);
         // $img_url = I("post.img_url");
         // $image = new \Think\Image(\Think\Image::IMAGE_GD,$img_url); // GD库
         // $save_path = UPLOAD_ROOT.C('UPLOAD2DIR')."/test/";
         // createDir($save_path);
         // $save_name = time().".jpg";
         // $save_url = $save_path.$save_name;
         // $image->crop(round(I("post.h")),round(I("post.w")),round(I("post.x1")),round(I("post.y1")))->thumb(200,200)->save($save_url);
         // echo $save_url;
     }
 }