當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Images::create方法代碼示例

本文整理匯總了PHP中Images::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::create方法的具體用法?PHP Images::create怎麽用?PHP Images::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Images的用法示例。


在下文中一共展示了Images::create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: post_upload

 public function post_upload($galleryID)
 {
     $path = path('public') . 'images/' . $galleryID;
     Fineuploader::init($path);
     $name = Fineuploader::getName();
     $fuResponse = Fineuploader::upload($name);
     if (isset($fuResponse['success']) && $fuResponse['success'] == true) {
         $file = Fineuploader::getUploadName();
         Bundle::start('resizer');
         $success = Resizer::open($file)->resize(300, 300, 'landscape')->save($path . '/thumbs/' . $name, 90);
         Images::create($galleryID, $name);
     }
     return Response::json($fuResponse);
 }
開發者ID:WebtoolsWendland,項目名稱:juballery,代碼行數:14,代碼來源:galleries.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rules = array('album_id' => 'required', 'myimage' => 'required|image');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         var_dump($validator->errors());
         // ->withErrors($validator)
         // ->withInput();
     }
     //$data = $request->only('album_id','myimage');
     //$img_data = $this->_dataurlToFile($data['cover_image']);
     // $f = finfo_open();
     // $extension = finfo_buffer($f, $img_data, FILEINFO_MIME_TYPE);
     // $f = finfo_close($f);
     // $input = array('cover_image' => $decodedData);
     // var_dump($input);
     //$file = $request->file('cover_image');
     // $random_name = str_random(8);
     $destinationPath = 'storage/users/albums/';
     //$filename=$random_name.'_cover.png';//.$extension;
     $file = $request->file('myimage');
     $filename = $file->getClientOriginalName();
     $file->move($destinationPath, $filename);
     // //$srcPath = $file->getRealPath();
     // var_dump($file->move('temp', $filename));
     // return;
     //Storage::move($data['myimage'],$destinationPath."test.jpg");
     // $uploadSuccess = $request->file('cover_image')
     // ->move($destinationPath, $filename);
     $album = Images::create(array('image' => $filename, 'album_id' => $request->album_id));
     return redirect('photos/' . $request->album_id);
     //,['id'=>$album->id]
 }
開發者ID:stevielu,項目名稱:MyBlog,代碼行數:39,代碼來源:PhotoController.php


注:本文中的Images::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。