當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。