• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中app\Image的典型用法代码示例。如果您正苦于以下问题:PHP Image类的具体用法?PHP Image怎么用?PHP Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Image类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: composeSideBar

 public function composeSideBar()
 {
     view()->composer('sections.right_bar', function ($view) {
         $sideBarImages = new Image();
         $view->with('sideBarImages', $sideBarImages->getSideBarImages());
     });
 }
开发者ID:victorfdt,项目名称:theliteracycenter,代码行数:7,代码来源:ViewImageServiceProvider.php


示例2: store

 /**
  * Store a newly uploaded resource in storage.
  *
  * @return Response
  */
 public function store(ImageRequest $request)
 {
     $input = $request->all();
     if (Auth::user()->image != null) {
         $image = Auth::user()->image;
         $file = Input::file('image');
         $name = time() . '-' . $file->getClientOriginalName();
         $image->filePath = $name;
         $file->move(public_path() . '/images/', $name);
     } else {
         // Store records process
         $image = new Image();
         $this->validate($request, ['title' => 'required', 'image' => 'required']);
         $image->title = $request->title;
         $image->description = $request->description;
         $image->user_id = Auth::user()->id;
         if ($request->hasFile('image')) {
             $file = Input::file('image');
             $name = time() . '-' . $file->getClientOriginalName();
             $image->filePath = $name;
             $file->move(public_path() . '/images/', $name);
         }
     }
     $image->save();
     $user = Auth::user();
     return redirect('/' . $user->username);
 }
开发者ID:jdeugarte,项目名称:twitter,代码行数:32,代码来源:ImageController.php


示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     try {
         if (!$request->hasFile('photo')) {
             return $this->respondWithError('No photo is selected');
         }
         $file = $request->file('photo');
         // Create Eloquent object
         $image = new Image();
         $image->point_id = $request->id;
         $image->filename = $this->generate_random_string();
         $image->mime_type = $file->getClientMimeType();
         $image->base_64 = $this->convert_to_base_64($file);
         $image->created_by = Auth::user()->id;
         $image->updated_by = Auth::user()->id;
         if (!$image->save()) {
             // If creation fails
             // Return error response
             return $this->respondInternalError();
         }
         // Select latest row from DB
         $resp = $image->orderBy('id', 'DESC')->first();
         // return with Fractal
         return Fractal::item($resp, new \App\Transformers\ImageTransformer())->responseJson(200);
     } catch (Exception $e) {
         return $this->respondInternalError();
     }
 }
开发者ID:arelstone,项目名称:Gps-RESTfull,代码行数:35,代码来源:ImageController.php


示例4: makeImage

 protected function makeImage($file, $height, $width, $randomFilename, $thumbnail = null)
 {
     $md5 = md5_file($file->getRealPath());
     $img = Image::make($file)->fit($height, $width);
     $path = 'images/';
     if ($thumbnail != null) {
         $path = 'images/thumb/';
     }
     $image = Images::where('md5_hash', $md5)->first();
     if ($image === null or $image->thumbnail_file == null) {
         Clockwork::info('Storing on Filesystem');
         $img->save(storage_path() . '/app/' . $path . $randomFilename . '.png', 90);
     }
     if ($image === null and $thumbnail === null) {
         Clockwork::info('New Image');
         $image = new Images();
         $image->user_id = Auth::user()->id;
         $image->filename = $file->getClientOriginalName();
         $image->file = $randomFilename . '.png';
         $image->height = $height;
         $image->width = $width;
         $image->md5_hash = $md5;
     } elseif ($thumbnail != null and $image->thumbnail_file == null) {
         Clockwork::info('Thumbnail Updated');
         $image->thumbnail_file = $randomFilename . '.png';
     }
     $image->save();
     return $image;
 }
开发者ID:becast,项目名称:GameReviewSite,代码行数:29,代码来源:ImageController.php


示例5: storeImage

 public function storeImage($userID, $imageName, $imagePath)
 {
     $storeImg = new Image();
     $storeImg->userID = $userID;
     $storeImg->imageName = $imageName;
     $storeImg->imagePath = $imagePath;
     $storeImg->save();
 }
开发者ID:deferdie,项目名称:tweet,代码行数:8,代码来源:Image.php


示例6: saveImagable

 public function saveImagable()
 {
     $imageable = new Image();
     $imageable->path = $this->getPathWithFile();
     $imageable->imageable_id = $this->model_id;
     $imageable->imageable_type = $this->model_class_path;
     $imageable->r_id = $this->r_id;
     $imageable->save();
     return $imageable;
 }
开发者ID:boybin,项目名称:n4backend,代码行数:10,代码来源:ImageController.php


示例7: newPicture

 public function newPicture($fileName, $image)
 {
     $path = public_path('/images/gallery/');
     File::exists($path) or File::makeDirectory($path, 0755, true);
     $image->resize(200, 200)->save($path . $fileName);
     $picture = new Image();
     $picture->user = Auth::user()->name;
     $picture->caption = Input::get('caption');
     $picture->imagePath = 'images/gallery/' . $fileName;
     $picture->save();
 }
开发者ID:mathewsandi,项目名称:Sezgi,代码行数:11,代码来源:DbGalleryRepository.php


示例8: saveAjax

 public function saveAjax(Request $request)
 {
     $filename = $request->get('name') . '-' . uniqid() . '.' . $request->get('format');
     $data = $request->get('data');
     $data = file_get_contents($data);
     file_put_contents(public_path() . '/media/tmp/' . $filename, $data);
     $image = new Image();
     $image->name = $request->get('name');
     $image->user_id = \Auth::user()->id;
     $image->save();
     $image->addMedia(public_path() . '/media/tmp/' . $filename)->toMediaLibrary();
 }
开发者ID:TahiriAbdou,项目名称:FacebookCloud,代码行数:12,代码来源:ImagesController.php


示例9: save

 public function save(Request $request)
 {
     $data = Input::get('image');
     list($type, $data) = explode(';', $data);
     list(, $data) = explode(',', $data);
     $data = base64_decode($data);
     $now = Carbon::now()->toDateTimeString();
     $random = strval(rand());
     $path = 'uploads/' . $now . '_' . $random . '.png';
     file_put_contents($path, $data);
     $image = new Image();
     $image->path = $path;
     $image->likes = 0;
     $image->save();
 }
开发者ID:prisacaruadela,项目名称:theWall,代码行数:15,代码来源:ImageController.php


示例10: compose

 public function compose(View $view)
 {
     $tags = Tag::orderBy('id', 'DESC')->get();
     $categories = Category::orderBy('id', 'DESC')->simplepaginate(7);
     $images = Image::orderBy('id', 'DESC')->paginate(4);
     $view->with('tags', $tags)->with('categories', $categories)->with('images', $images);
 }
开发者ID:EstevenJaviier,项目名称:Semillero-IN,代码行数:7,代码来源:AsideComposer.php


示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Truncate
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     User::truncate();
     Admin::truncate();
     Customer::truncate();
     Address::truncate();
     Category::truncate();
     Product::truncate();
     Brand::truncate();
     Type::truncate();
     Image::truncate();
     DB::statement('TRUNCATE category_product;');
     Product::clearIndices();
     Product::reindex();
     //Unguard
     Model::unguard();
     //Call
     $this->call(UsersTableSeeder::class);
     $this->call(ProductsTableSeeder::class);
     //Reguard
     Model::reguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
开发者ID:jentleyow,项目名称:megadeal,代码行数:30,代码来源:DatabaseSeeder.php


示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
开发者ID:heckyeah,项目名称:ngaitauira,代码行数:31,代码来源:EventController.php


示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user_id = Auth::User()->id;
     if (Input::file()) {
         $file_image = array('image' => Input::file('file_image'));
         $rules = array('image' => 'required');
         $validator = validator::make($file_image, $rules);
         if ($validator->fails()) {
             return redirect::to('photo')->withInput()->withErrors($validator);
         } else {
             if (Input::file('file_image')->isValid()) {
                 $path = '../public/images';
                 $extension = Input::file('file_image')->getClientOriginalExtension();
                 $fileName = rand() . '.' . $extension;
                 Input::file('file_image')->move($path, $fileName);
                 Image::create(array('user_id' => $user_id, 'path' => $fileName));
                 Session::flash('success', 'Upload successfully');
                 return Redirect::to('photo');
             } else {
                 Session::flash('error', 'uploaded file is not valid');
                 return Redirect::to('photo');
             }
         }
     }
 }
开发者ID:GrigorAtaryan,项目名称:Social_network,代码行数:31,代码来源:ImageController.php


示例14: save

 /**
  * Save product to database
  */
 public function save()
 {
     $data = ['item_id' => $this->item_id, 'shop_id' => $this->shop_id] + $this->data;
     if (!App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->update($this->data) && !App\Product::insert($data)) {
         return false;
     }
     $this->id = App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->first()->id;
     if (!$this->id) {
         return false;
     }
     foreach ($this->images as $image) {
         if (!App\Image::where('url', $image['url'])->update($image) && !App\Image::insert($image + ['product_id' => $this->id])) {
             return false;
         }
     }
     /*if( isset( $this->params ) )
     		{
     			foreach( $this->params as $param )
     			{
     				if( !App\Param::where( 'param', $param['param'] )->update( $param ) && 
     					!App\Param::insert( $param + [ 'product_id' => $this->id ] ) )
     					return false;
     			}
     		}*/
     return true;
 }
开发者ID:bausano,项目名称:Ebchod,代码行数:29,代码来源:Product.php


示例15: aboutUs

 /**
  * Fungsi buat tampilan about us
  */
 public function aboutUs()
 {
     $about = About::first();
     $gallery = Image::all();
     $tipe = Type::all();
     return view('FrontEnd.aboutUs', compact('about', 'gallery', 'tipe'));
 }
开发者ID:semmiverian,项目名称:webJok,代码行数:10,代码来源:frontEndController.php


示例16: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     WorkCategory::saving(function ($workCategory) {
         if ($workCategory->position > 0) {
             return true;
         }
         $workCategory->position = WorkCategory::max('position') + 1;
         return $workCategory;
     });
     Work::saving(function ($work) {
         if ($work->position > 0) {
             return true;
         }
         $work->position = Work::max('position') + 1;
         return $work;
     });
     Image::deleted(function ($image) {
         if (file_exists($image->path)) {
             unlink($image->path);
         }
         if (file_exists($image->thumbnail)) {
             unlink($image->thumbnail);
         }
         return true;
     });
 }
开发者ID:postalu,项目名称:postal,代码行数:31,代码来源:PostalServiceProvider.php


示例17: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $image = Image::findOrFail($id);
     $image->delete();
     flash()->warning('Gambar telah dihapus!');
     return redirect('/dashboard/images');
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:13,代码来源:ImagesController.php


示例18: postVote

 public function postVote(Request $request)
 {
     if (!Auth::id()) {
         return response()->json(['message' => 'user not found'], 400);
     }
     $profile = Profile::where("id", "=", $request->input("profileId"))->first();
     if (!$profile || $profile->isActive != 1) {
         return response()->json(['message' => 'profile not found'], 400);
     }
     $image_file = $request->file('image');
     if (!$image_file) {
         return response()->json(['message' => 'resource not found'], 400);
     }
     $image = Image::create();
     $image_file->move(storage_path(), md5($image->id));
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->resize(1000, 1000, function ($constraint) {
         $constraint->aspectRatio();
         $constraint->upsize();
     });
     $img->save(base_path() . '/public/images/votes/' . md5($image->id) . '.jpg', 100);
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->fit(80, 80);
     $img->save(base_path() . '/public/images/votes/thumb_80_' . md5($image->id) . '.jpg', 100);
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->fit(132, 99);
     $img->save(base_path() . '/public/images/votes/thumb_132_' . md5($image->id) . '.jpg', 100);
     $vote = Vote::firstOrCreate(['user_id' => Auth::id(), 'profile_id' => $request->input("profileId")]);
     $vote->user_id = Auth::id();
     $vote->profile_id = $request->input("profileId");
     $vote->photo = md5($image->id);
     $vote->save();
     //$request->session()->push('uploaded_images', $image->id);
     return response()->json(['message' => 'created', 'path' => '/images/votes/thumb_80_' . md5($image->id) . '.jpg', 'imageId' => $request->input("imageId")], 201);
 }
开发者ID:ElasticOrange,项目名称:canon-orasul-respira-foto,代码行数:35,代码来源:UploadImageController.php


示例19: 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


示例20: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $sliders = Slider::latest()->get();
     $images = Image::latest()->take(4)->get();
     $news = News::latest('published_at')->published()->take(3)->get();
     $articles = Article::latest('published_at')->published()->take(3)->get();
     return view('pages.index', compact('articles', 'news', 'images', 'sliders'));
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:13,代码来源:PagesController.php



注:本文中的app\Image类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Item类代码示例发布时间:2022-05-23
下一篇:
PHP app\Group类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap