コード例 #1
0
ファイル: Common.php プロジェクト: comsi02/ordermart
 public function s3_file_upload()
 {
     $org_file_name = $_FILES["myfile"]["name"];
     $tmp_file_name = $_FILES["myfile"]["tmp_name"];
     $afinfo = explode('.', $org_file_name);
     $s3_file_name = date('Ymd_His_') . str_random(10) . '.' . end($afinfo);
     if ($_FILES["myfile"]['error'] == 0) {
         rename($tmp_file_name, env('UPLOAD_PATH') . $s3_file_name);
         \Common::make_product_img($s3_file_name, 720);
         $res = \Common::s3_upload($s3_file_name, 'product/');
         return $res;
     } else {
         return array('success' => false, 'message' => '', 'filename' => '');
     }
 }
コード例 #2
0
 public function profile_submit()
 {
     $data = \Request::all();
     if (isset($data['image'])) {
         $file_name = \Common::get_img_filename($data['image']);
         \Common::make_square_img($file_name, 140);
         $res = \Common::s3_upload($file_name, 'person/');
         if ($res['success']) {
             $person = Person::find(\Auth::user()->id);
             $person->image = $res['filename'];
             $person->save();
         }
     }
     return \Redirect()->action('PersonController@profile');
 }
コード例 #3
0
 public function edit_submit()
 {
     $data = \Request::all();
     $company = Company::find(\Request::input('company_id'));
     $company->name = $data['name'];
     if (isset($data['image'])) {
         $file_name = \Common::get_img_filename($data['image']);
         \Common::make_square_img($file_name, 140);
         $res = \Common::s3_upload($file_name, 'company/');
         if ($res['success']) {
             $company->ci = $res['filename'];
         }
     }
     $company->status = $data['status_group'];
     $company->save();
     return \Redirect()->action('CompanyController@index');
 }