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


PHP Image::find方法代碼示例

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


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

示例1: update

 /**
  * Update a minifig
  * @access public
  * @param  int $id
  * @param  MinifigRequest $request
  */
 public function update($id, MinifigRequest $request)
 {
     $minifig = Minifig::find($id);
     $minifig->name = $request->name;
     $minifig->set_id = $request->set_id;
     $minifig->save();
     if ($request->images_to_delete) {
         foreach ($request->images_to_delete as $id_image) {
             $image = Image::find($id_image);
             $image->delete();
         }
     }
     $files = $request->file('files');
     if (count($files) > 0) {
         foreach ($files as $file) {
             if ($file) {
                 $filename = sha1(rand(1, 100000) . time()) . '.' . $file->guessExtension();
                 $file->move($this->uploadpath, $filename);
                 Image::create(['minifig_id' => $id, 'filename' => $filename]);
             }
         }
     }
     $request->session()->flash('msg', 'Minifig saved');
     return redirect()->action('MinifigController@index');
 }
開發者ID:mazedlx,項目名稱:minifig,代碼行數:31,代碼來源:MinifigController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $image = Image::find($id)->get();
     #  return view("image/show",['img'=>$image]);
     return Redirect::to('/home');
 }
開發者ID:neetp7k9,項目名稱:laravel_practice,代碼行數:13,代碼來源:imageManage.php

示例3: updateText

 public function updateText(Request $request)
 {
     $id = $request->get('id');
     $image = Image::find($id);
     $image->text = $request->get('text');
     $image->save();
     exit;
 }
開發者ID:phpfour,項目名稱:bangla-ocr,代碼行數:8,代碼來源:ImageController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $image = Image::find($id);
     $minifig = $image->minifig;
     $image->delete();
     Session::flash('msg', 'Successfully deleted');
     return redirect()->action('MinifigController@show', ['id' => $minifig->id]);
 }
開發者ID:mazedlx,項目名稱:minifig,代碼行數:14,代碼來源:ImageController.php

示例5: deleteImage

 public function deleteImage()
 {
     $user = Auth::User();
     $userID = $user->id;
     $image = Image::find($_POST['imageID']);
     Storage::delete("{$userID}/{$image->imageName}");
     Image::destroy($_POST['imageID']);
     return "Image Deleted!";
 }
開發者ID:deferdie,項目名稱:tweet,代碼行數:9,代碼來源:fileManagerController.php

示例6: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data = Image::find($id);
     if ($data) {
         return view('forone::' . $this->uri . "/edit", compact('data'));
     } else {
         return $this->redirectWithError('data not found.');
     }
 }
開發者ID:YogiAi,項目名稱:ColorTalk_PHP,代碼行數:15,代碼來源:ImagesController.php

示例7: removeClosedImages

 public function removeClosedImages($closedImages)
 {
     foreach ($closedImages as $image) {
         $propertyImage = \App\Image::find($image->id);
         if ($propertyImage) {
             $propertyImage->delete();
         }
         dispatch((new KillImageFromDisk($image->dataUri))->onQueue('killImage'));
     }
 }
開發者ID:SapioBeasley,項目名稱:jacobsgroupvegas.com,代碼行數:10,代碼來源:RemoveProperties.php

示例8: index

 /**
  * Handles displaying an image on a request.
  *
  * @param $hash
  * @return mixed
  * @throws \App\Exceptions\MissingImageException
  */
 public function index($hash)
 {
     if (is_numeric($hash)) {
         throw new AccessDeniedException('You should not access an image by it\'s ID.');
     }
     $hash = $this->stripExtension($hash);
     $id = $this->hash->decode($hash);
     $image = Image::find($id);
     return response($image->image, 200)->header('Content-Type', 'image/png');
 }
開發者ID:noteventhrice,項目名稱:duffleimg,代碼行數:17,代碼來源:MainController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if (Auth::check()) {
         $image = Image::find($id);
         $image->title = $request->input('title');
         $image->description = $request->input('description');
         $image->item_id = $request->input('itemid');
         $image->save();
         return $image;
     }
 }
開發者ID:psyrax,項目名稱:junkerLaravel,代碼行數:18,代碼來源:ImageController.php

示例10: postMove

 public function postMove()
 {
     $rules = array('new_album' => 'required|numeric|exists:albums,id', 'photo' => 'required|numeric|exists:images,id');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route('index');
     }
     $image = Image::find(Input::get('photo'));
     $image->album_id = Input::get('new_album');
     $image->save();
     return Redirect::route('show_album', array('id' => Input::get('new_album')));
 }
開發者ID:deadlance,項目名稱:laravel_project_test_2,代碼行數:12,代碼來源:ImageController.php

示例11: apprecier

 public function apprecier($id_image, Request $request)
 {
     if (!is_numeric($id_image) || !Image::find($id_image)) {
         return response()->json(['response' => 'ERREUR.']);
     }
     if (Auth::user()->aime($id_image)) {
         DB::table('apprecie')->where(['id_utilisateur' => Auth::user()->id, 'id_image' => $id_image], false)->delete();
         return response()->json(['response' => 'doitUnlike']);
     } else {
         DB::table('apprecie')->insert(['id_utilisateur' => Auth::user()->id, 'id_image' => $id_image]);
         return response()->json(['response' => 'doitLike']);
     }
 }
開發者ID:Alex01723,項目名稱:PTUT-CompetitionImage,代碼行數:13,代碼來源:ImageController.php

示例12: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->option('all')) {
         foreach (Image::all() as $image) {
             $image->regenerate();
         }
     } elseif ($this->argument('image')) {
         $image = Image::find($this->argument('image'));
         if (count($image)) {
             $image->regenerate();
         }
     }
 }
開發者ID:santakani,項目名稱:santakani.com,代碼行數:18,代碼來源:ImageRegenerate.php

示例13: removeUnrelatedImages

 public function removeUnrelatedImages()
 {
     $skip = 0;
     $removeArray = [];
     do {
         $images = \App\Image::whereDoesntHave('property')->take(100)->skip($skip)->get();
         foreach ($images as $imageKey => $image) {
             \App\Image::find($image->id)->delete();
             dispatch((new KillImageFromDisk($image->dataUri))->onQueue('killImage'));
             $removeArray[] = $image->dataUri;
         }
         \Storage::delete($removeArray);
         $skip += 100;
     } while ($images->isEmpty() == false);
 }
開發者ID:SapioBeasley,項目名稱:jacobsgroupvegas.com,代碼行數:15,代碼來源:RemoveUnrelatedImages.php

示例14: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     //This id is passed by the controller that calls the request class
     $image = Image::find($this->id);
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['name' => 'required|unique:images,name', 'type' => 'required', 'order' => 'numeric', 'image' => 'required|image|mimes:jpeg,bmp,png', 'link' => 'string'];
         case 'PUT':
         case 'PATCH':
             return ['name' => 'required|unique:images,name,' . $image->id, 'type' => 'required', 'order' => 'numeric', 'image' => 'image|mimes:jpeg,bmp,png', 'link' => 'string'];
         default:
             break;
     }
 }
開發者ID:victorfdt,項目名稱:theliteracycenter,代碼行數:22,代碼來源:ImageRequest.php

示例15: validation

 public function validation(AdminRequest $request)
 {
     foreach ($request->all() as $element => $coche) {
         // On vérifie si l'image souhaite être envoyée ou non
         // En cas d'autre réponse, on ignore et l'image reste soumise à validation ;-)
         if (starts_with($element, 'radio')) {
             switch ($coche) {
                 case 'envoi_oui':
                     Image::find(substr($element, 5))->est_gardee(true);
                     break;
                 case 'envoi_non':
                     Image::find(substr($element, 5))->est_gardee(false);
                     break;
             }
         }
     }
     return Redirect::to('admin');
 }
開發者ID:Alex01723,項目名稱:PTUT-CompetitionImage,代碼行數:18,代碼來源:AdminController.php


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