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


PHP Image::rotate方法代码示例

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


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

示例1: run

 /**
  * Perform orientation image manipulation.
  * @param  Image $image The source image.
  * @return Image The manipulated image.
  */
 public function run(Image $image)
 {
     $orientation = $this->getOrientation();
     if ($orientation === 'auto') {
         return $image->orientate();
     }
     return $image->rotate($orientation);
 }
开发者ID:kleisauke,项目名称:imagesweserv,代码行数:13,代码来源:Orientation.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: 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

示例4: applyFilter

 /**
  * Applies filter effects to the given image
  *
  * @param Image\Image $image The image to filter.
  *
  * @return Image\Image The filtered image.
  *
  * @throws FilterException if an invalid mode has been given.
  */
 public function applyFilter(Image\Image $image)
 {
     switch ($this->mode) {
         case self::FLIP_HORIZONTAL:
             return $image->flip('h');
         case self::FLIP_VERTICAL:
             return $image->flip('v');
         case self::ROTATE_LEFT:
             return $image->rotate(90);
         case self::ROTATE_RIGHT:
             return $image->rotate(-90);
         default:
             throw new FilterException('De bewerking die u gekozen heeft bestaat niet.', 1);
     }
 }
开发者ID:BitmanNL,项目名称:traffictower-cms,代码行数:24,代码来源:FlipRotateFilter.php

示例5: run

 /**
  * Perform orientation image manipulation.
  * @param  Request $request The request object.
  * @param  Image   $image   The source image.
  * @return Image   The manipulated image.
  */
 public function run(Request $request, Image $image)
 {
     $orientation = $this->getOrientation($request->get('or'));
     if ($orientation === 'auto') {
         return $image->orientate();
     }
     return $image->rotate($orientation);
 }
开发者ID:awebc,项目名称:web_xbf,代码行数:14,代码来源:Orientation.php

示例6: rotate

 /**
  * Rotate an image by the given number of degrees.
  *
  * @param  int $degrees The number of (clockwise) degrees to rotate the image.
  * @param  string|null $background hexadecimal background color
  * @param  bool $random
  */
 public function rotate($degrees, $background = null, $random = false)
 {
     if ($background) {
         $background = trim($background);
     } else {
         $background = "ffffff";
     }
     if ($random) {
         $deg = abs((double) $degrees);
         $degrees = rand(-1 * $deg, $deg);
     }
     $this->image->rotate($degrees, $background);
 }
开发者ID:onigoetz,项目名称:imagecache,代码行数:20,代码来源:Image.php

示例7: rotation

 protected function rotation()
 {
     // Auto orientate
     $this->image->orientate();
     if ($this->flip) {
         $this->image->flip($this->flip);
     }
     // Rotate within the existing frame
     if ($this->rotation) {
         $width = $this->image->getWidth();
         $height = $this->image->getHeight();
         $this->image->rotate($this->rotation);
         $this->image->crop($width, $height);
     }
     // Rotate entire image
     if ($this->orientation) {
         $this->image->rotate($this->orientation);
     }
 }
开发者ID:Monori,项目名称:imgback,代码行数:19,代码来源:ImageHandler.php

示例8: rotate

 /**
  * Rotate image with given angle
  *
  * @param float $angle
  * @param string $color
  * @param int $ignore_transparent
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function rotate($angle = 0, $bgcolor = '#000000', $ignore_transparent = 0)
 {
     return \Intervention\Image\Image::rotate($angle, $bgcolor, $ignore_transparent);
 }
开发者ID:jorzhikgit,项目名称:MLM-Nexus,代码行数:13,代码来源:_ide_helper.php

示例9: applyFilter

 /**
  * Applies filter to given image
  *
  * @param  Image $image
  * @return Image
  */
 public function applyFilter(Image $image)
 {
     return $image->rotate($this->rotate);
 }
开发者ID:parfumix,项目名称:laravel-image-uploader,代码行数:10,代码来源:Rotate.php

示例10: process

 public function process(Image $image)
 {
     if ($this->request->query->has('rotate')) {
         $image->rotate((double) $this->request->query->get('rotate'));
     }
 }
开发者ID:ambroisemaupate,项目名称:intervention-request,代码行数:6,代码来源:RotateProcessor.php

示例11: handle

 /**
  * Handle the image manipulation request
  * @param  \Intervention\Image\Image $image
  * @param  array                     $options
  * @return \Intervention\Image\Image
  */
 public function handle($image, $options)
 {
     $options = array_merge($this->defaults, $options);
     return $image->rotate($options['angle'], $options['bgcolor']);
 }
开发者ID:Houbsi,项目名称:Media,代码行数:11,代码来源:Rotate.php


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