当前位置: 首页>>代码示例>>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;未经允许,请勿转载。