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


PHP Image::exif方法代码示例

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


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

示例1: setFile

 public function setFile($file)
 {
     $this->file = $file;
     $this->image = Image::make($this->file);
     $this->iptc = $this->image->iptc();
     $this->exif = $this->image->exif();
     return $this;
 }
开发者ID:katzefudder,项目名称:Photoindexer,代码行数:8,代码来源:ImageHandler.php

示例2: execute

 /**
  * Correct image orientation according to Exif data
  *
  * @param  \Intervention\Image\Image $image
  * @return boolean
  */
 public function execute($image)
 {
     switch ($image->exif('Orientation')) {
         case 2:
             $image->flip();
             break;
         case 3:
             $image->rotate(180);
             break;
         case 4:
             $image->rotate(180)->flip();
             break;
         case 5:
             $image->rotate(270)->flip();
             break;
         case 6:
             $image->rotate(270);
             break;
         case 7:
             $image->rotate(90)->flip();
             break;
         case 8:
             $image->rotate(90);
             break;
     }
     return true;
 }
开发者ID:hilmysyarif,项目名称:sic,代码行数:33,代码来源:OrientateCommand.php

示例3: height

 public function height(Image $image)
 {
     $exif = $image->exif();
     $height = isset($exif['ExifImageLength']) ? $exif['ExifImageLength'] : '';
     return $height;
 }
开发者ID:Tirme,项目名称:blog,代码行数:6,代码来源:Exif.php

示例4: exif

 /**
  * Read Exif data from the current image
  * 
  * Note: Windows PHP Users - in order to use this method you will need to
  * 
  * enable the mbstring and exif extensions within the php.ini file.
  *
  * @param string $key
  * @return mixed 
  * @static 
  */
 public static function exif($key = null)
 {
     return \Intervention\Image\Image::exif($key);
 }
开发者ID:jorzhikgit,项目名称:MLM-Nexus,代码行数:15,代码来源:_ide_helper.php

示例5: process

 public function process()
 {
     $data = $this->loadData();
     if ($data !== true) {
         return $this->failure($data);
     }
     $mobile = (int) $this->getProperty('mobile', 0);
     if ($mobile == 1) {
         $orientation = $this->img->exif('Orientation');
         switch ($orientation) {
             case 3:
                 $this->img->rotate(180);
                 break;
             case 6:
                 $this->img->rotate(-90);
                 break;
             case 8:
                 $this->img->rotate(90);
                 break;
         }
     }
     if (isset($this->data['rotate'])) {
         $rotate = $this->data['rotate'] * -1.0;
         $this->img->rotate($rotate);
     }
     $crop = $this->getProperty('crop', 0);
     if ($crop == 1 && isset($this->data['width']) && isset($this->data['height'])) {
         $width = intval($this->data['width']);
         $height = intval($this->data['height']);
         if ($height != 0 && $width != 0) {
             $this->img->crop($width, $height, intval($this->data['x']), intval($this->data['y']));
         }
     }
     $fileName = $this->generateUniqueFileName();
     $width = (int) $this->md->getOption('resizer.width', null, 0);
     $width = empty($width) ? null : $width;
     $height = (int) $this->md->getOption('resizer.height', null, 0);
     $height = empty($height) ? null : $height;
     $profileName = $this->getProperty('profile', '');
     if (!empty($profileName) && $crop == 1) {
         $profiles = $this->modx->fromJSON($this->md->getOption('cropper.profiles', null, '[]'));
         foreach ($profiles as $profile) {
             if (!isset($profile['name']) || $profile['name'] != $profileName) {
                 continue;
             }
             $profileWidth = (int) $profile['width'];
             $profileHeight = (int) $profile['height'];
             $width = empty($profileWidth) ? $width : $profileWidth;
             $height = empty($profileHeight) ? $height : $profileHeight;
             break;
         }
     }
     if ($width != null || $height != null) {
         $this->img->resize($width, $height, function ($constraint) {
             /** @var \Intervention\Image\Constraint $constraint */
             $constraint->aspectRatio();
             $constraint->upsize();
         });
     }
     $this->img->save($this->uploadPath . $fileName . '.' . $this->extension);
     return $this->success('', array('path' => $this->uploadURL . $fileName . '.' . $this->extension, 'name' => $this->originalName));
 }
开发者ID:ashliewebb,项目名称:ashliewebb,代码行数:62,代码来源:imageupload.class.php


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