当前位置: 首页>>代码示例>>PHP>>正文


PHP Image::find方法代码示例

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


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

示例1: fire

 /**
  * Function that gets called on a job
  * Push::queue('smsSender', $emergency);
  *
  * @param $job
  * @param Emergency $emergency
  */
 public function fire($job, $image)
 {
     $s3 = AWS::get('s3');
     $image = Image::find($image['id']);
     if (!$image) {
         return $job->delete();
     }
     try {
         $imageUtil = new ImageUtil($image->origin);
         $galleryImageUtil = new ImageUtil($image->origin);
     } catch (Exception $e) {
         return $job->delete();
     }
     $image->thumbnail = $this->uploadImage($s3, $imageUtil->resize2('thumbnail')->getImage());
     Log::debug("From queue: Thumbnail: width - {$imageUtil->getWidth()}, height - {$imageUtil->getHeight()}");
     Log::debug("Thumbnail URL: {$image->thumbnail}");
     $this->preventMemoryLeak();
     $image->regular = $this->uploadImage($s3, $galleryImageUtil->resize2('gallery')->getImage());
     Log::debug("From queue: Gallery: width - {$galleryImageUtil->getWidth()}, height - {$galleryImageUtil->getHeight()}");
     Log::debug("Gallery URL: {$image->regular}");
     $this->preventMemoryLeak();
     $image->width = $galleryImageUtil->getWidth();
     $image->height = $galleryImageUtil->getHeight();
     $image->save();
     return $job->delete();
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:33,代码来源:ImagesResizeQueue.php

示例2: deleteAction

 public function deleteAction()
 {
     //TODO check ce_has_image, link is not available but action is callable!!
     //delete image files (org./copy/thumb)
     //delete image
     //delete metadata image -> DB on delete cascade
     $request = $this->getRequest();
     $imageId = intval($this->getRequest()->getParam(Image::COL_ID));
     $image = new Image();
     //get image_guid
     //get original extension
     $rowset = $image->find($imageId);
     if (count($rowset) == 1) {
         $rowsetArray = $rowset->toArray();
         $imageRow = $rowsetArray[0];
         $imGuid = $imageRow[Image::COL_GUID];
         $path_parts = pathinfo($imageRow[Image::COL_ORIGINAL_FILENAME]);
         $imExt = $path_parts['extension'];
         $filename = $imGuid . '.' . $imExt;
         $jpgFilename = $imGuid . '.' . 'jpg';
         //delete file org/guid+org_ext
         //delete file copy/guid+.jpg
         //delete file thumb/guid+.jpg
         $RELATIVE_UPLOAD_PATH = 'images/originals';
         //without pre- and post-slash!
         $RELATIVE_PATH_IMAGE_THUMBNAILS = 'images/thumbnails';
         $RELATIVE_PATH_IMAGE_SHRINKED_WORKING_COPIES = 'images/shrinked_working_copies';
         try {
             $myFile = $RELATIVE_UPLOAD_PATH . '/' . $filename;
             $fh = fopen($myFile, 'w');
             fclose($fh);
             unlink($myFile);
             $myFile = $RELATIVE_PATH_IMAGE_SHRINKED_WORKING_COPIES . '/' . $jpgFilename;
             $fh = fopen($myFile, 'w');
             fclose($fh);
             unlink($myFile);
             $myFile = $RELATIVE_PATH_IMAGE_THUMBNAILS . '/' . $jpgFilename;
             $fh = fopen($myFile, 'w');
             fclose($fh);
             unlink($myFile);
         } catch (Exception $e) {
             throw new Zend_Exception('Error: can not open file');
         }
         //note: delete of metadata is executed from db
         $image->delete($image->getAdapter()->quoteInto(Image::COL_ID . ' = ?', $imageId));
         //hard delete plus:
         //delete ce_has_image
         //delete annotations
         //delete dots
         //		$imageId = intval($this->getRequest()->getParam(Image::COL_ID));
         //			$imageResult = $imageTable->find($imageId)->current();
         //			if($imageResult != null){
         //				$imageArray = $imageResult->toArray();
         //			}else{
         //				$imageArray = array();
         //			}
     }
     $redirect = new Zend_Controller_Action_Helper_Redirector();
     $redirect->setGoto('search', 'search', 'image');
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:60,代码来源:EditController.php

示例3: show

 public function show()
 {
     require_once 'models/comment.php';
     $image = Image::find(Request::get_id());
     $comments = Comment::find_by_image(Request::get_id());
     require_once 'views/images/show.php';
 }
开发者ID:Hield,项目名称:imagesharing,代码行数:7,代码来源:images_controller.php

示例4: deAuthorize

 public function deAuthorize($id)
 {
     $image = Image::find($id);
     $image->approved = '0';
     $image->save();
     return Redirect::back()->withInput()->withErrors('Image #' . $id . ' was de-authorized.');
 }
开发者ID:slopedoo,项目名称:laravel,代码行数:7,代码来源:ImagesController.php

示例5: mutateAttribute

 public function mutateAttribute($key, $value)
 {
     preg_match('/(.*)_(image|file)(_la)?$/', $key, $matches);
     if (count($matches) > 0) {
         list($match_data, $field_name_prefix, $field_type) = $matches;
         $la_mode = count($matches) == 4;
         $field_name = "{$field_name_prefix}_{$field_type}_id";
         if (!$this->{$field_name}) {
             return null;
         }
         switch ($field_type) {
             case 'image':
                 $obj = Image::find($this->{$field_name});
                 break;
             case 'file':
                 $obj = Attachment::find($this->{$field_name});
                 break;
             default:
                 throw new \Exception("Unrecognized attachment type {$field_type}");
         }
         if (!$obj) {
             return null;
         }
         if ($la_mode) {
             // Recover image if missing from Laravel Admin
             $la_fpath = config('laravel-stapler.images.la_path') . "/{$obj->att_file_name}";
             if (!file_exists($la_fpath)) {
                 copy($obj->path('admin'), $la_fpath);
             }
             return $obj->att_file_name;
         }
         return $obj->att;
     }
     return parent::mutateAttribute($key, $value);
 }
开发者ID:benallfree,项目名称:laravel-stapler-images,代码行数:35,代码来源:AttachmentTrait.php

示例6: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $imageModel = new Image();
     $imagenes = $imageModel->find('all');
     $this->set('imagenes', $imagenes);
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
开发者ID:Aymerich03,项目名称:salondebelleza,代码行数:38,代码来源:PagesController.php

示例7: destroy

 /**
  * Remove the specified resource from storage and filesystem.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $image = Image::find($id);
     $image->delete();
     unlink('uploads/' . $image->filename);
     Session::flash('message', 'Sucessfully deleted ' . $image->filename);
     return Redirect::to('images');
 }
开发者ID:nsmith7989,项目名称:spreadsheet,代码行数:14,代码来源:ImagesController.php

示例8: flag

 /**
  * returns the flag Image Model Object if any
  * @return null
  */
 public function flag()
 {
     $res = DB::table('image')->where('locality_id', $this->id)->first();
     if ($res) {
         return Image::find($res->id);
     }
     return null;
 }
开发者ID:andreuramos,项目名称:beers,代码行数:12,代码来源:Locality.php

示例9: getImageIdAttribute

 public function getImageIdAttribute($value)
 {
     if ($value) {
         $image = Image::find($value);
     } else {
         $image = Image::where('album_id', $this->id)->first();
     }
     return $image ? $image->thumburl : '';
 }
开发者ID:abhishekchaudhary996,项目名称:auto-generating-gallery,代码行数:9,代码来源:Album.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $image = Image::find($id);
     $image->delete();
     Session::flash('status', true);
     Session::flash('messages', array('Đã xóa ảnh'));
     return Redirect::route('admin.image.index');
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:15,代码来源:BEImageController.php

示例11: showAction

 public function showAction()
 {
     $this->logger->entering();
     $this->logger->info('Load the image by id');
     $images = new Image();
     $image = $images->find($this->_getParam('id'))->current();
     $this->logger->info('Generating response');
     $this->getResponse()->setHeader('Content-Type', $image->content_type)->setHeader('Content-Disposition', "inline; filename=\"{$image->name}\"")->setBody($image->data);
     $this->logger->exiting();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:10,代码来源:ImageController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $this->image = Image::find($id);
     $this->image->fill(Input::all());
     if (!$this->image->valid()) {
         return Redirect::back()->withInput()->with('errors', $this->image->errors);
     } else {
         $this->image->update();
         return Redirect::route('projects.index');
     }
 }
开发者ID:jcstrandburg,项目名称:portfoliowriter,代码行数:17,代码来源:ImageController.php

示例13: destroy

 public function destroy($projectId, $imageId)
 {
     $image = Image::find($imageId);
     $destinationPath = public_path() . '/uploads/images/';
     if ($image->project_id == $projectId) {
         if (Image::destroy($imageId)) {
             File::delete($destinationPath . $image->path);
             return Response::json(['alert' => Messages::$deleteSuccess . 'image']);
         } else {
             return Response::json(['alert' => Messages::$deleteFail . 'image'], 404);
         }
     }
 }
开发者ID:perinikhil,项目名称:rmm-backend,代码行数:13,代码来源:ImageController.php

示例14: __construct

 /**
  * Método construtor
  * @param array $info Atributos do tamanho da imagem
  */
 public function __construct($info = array())
 {
     if (count($info) > 0) {
         $this->setId($info['id']);
         $image = Image::find($info['image_id']);
         $this->setImage($image);
         $imageType = ImageType::find($info['image_type_id']);
         $this->setImageType($imageType);
         $this->setFileName($info['file_name']);
         $this->setFileContentType($info['file_content_type']);
         $this->setFileSize($info['file_size']);
     }
 }
开发者ID:patrickespake,项目名称:go2images,代码行数:17,代码来源:ImageSize.php

示例15: destroy

 public function destroy($id)
 {
     $image = Image::find($id);
     if ($image) {
         $image->album->delete();
         $image->delete();
         Session::flash('status', 'success');
         Session::put('message', array('0' => 'Successed'));
         return Redirect::to('album?u=' . Session::get('current_user'));
     } else {
         Session::flash('status', 'fail');
         Session::put('message', array('0' => 'Failed'));
         return Redirect::to('image/' . $id);
     }
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:15,代码来源:ImagesController.php


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