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


PHP Image::fit方法代码示例

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


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

示例1: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(150, 150, function ($contraint) {
     }, 'top');
 }
开发者ID:Alxmerino,项目名称:portfolio-16v.laravel,代码行数:5,代码来源:ImageSmall.php

示例2: run

 /**
  * @param \Intervention\Image\Image $image
  *
  * @return void
  */
 public function run(Image $image)
 {
     $callback = function (Constraint $constraint) {
         $constraint->upsize();
     };
     $image->fit($this->width, $this->height, $callback, $this->position)->interlace($this->interlace);
 }
开发者ID:livetyping,项目名称:hermitage,代码行数:12,代码来源:Fit.php

示例3: applyFilter

 /**
  * Applies filter effects to the given image
  *
  * @param Image\Image $image The image to filter.
  *
  * @return Image\Image The filtered image.
  */
 public function applyFilter(Image\Image $image)
 {
     $image->fit(100, 100, function ($constraint) {
         $constraint->upsize();
     });
     return $image;
 }
开发者ID:BitmanNL,项目名称:traffictower-cms,代码行数:14,代码来源:ThumbnailFilter.php

示例4: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700, function ($constraint) {
         //$constraint->aspectRatio();
         //$constraint->upsize();
     })->encode('jpg', 70);
 }
开发者ID:stjanilofts,项目名称:normx,代码行数:7,代码来源:slickFilter.php

示例5: process

 public function process(Image $image)
 {
     if ($this->request->query->has('fit') && !$this->request->query->has('width') && !$this->request->query->has('height') && 1 === preg_match('#^([0-9]+)[x\\:]([0-9]+)$#', $this->request->query->get('fit'), $fit)) {
         $image->fit($fit[1], $fit[2], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
开发者ID:ambroisemaupate,项目名称:intervention-request,代码行数:8,代码来源:FitProcessor.php

示例6: process

 /**
  * {@inheritdoc}
  */
 public function process(\Intervention\Image\Image $image)
 {
     // Manipulate the image as required
     $image->fit(320, 240);
     // Optionally encode the manipulated image or let
     // imageRack encode it with the default values.
     // $image->encode();
     // Return the manipulated image
     return $image;
 }
开发者ID:diarmuidie,项目名称:imagerack,代码行数:13,代码来源:Small.php

示例7: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(1130, 430);
     //->greyscale()
     //->colorize(0, 10, 30)
     //->contrast(-25)
     //->brightness(-25)
     //->blur(50);
     //->gamma(3.5);
 }
开发者ID:stjanilofts,项目名称:kl,代码行数:10,代码来源:bannerFilter.php

示例8: process

 public function process(Image $image)
 {
     if ($this->request->query->has('crop') && 1 === preg_match('#^([0-9]+)[x\\:]([0-9]+)$#', $this->request->query->get('crop'), $crop) && ($this->request->query->has('width') || $this->request->query->has('height'))) {
         $fitRatio = (double) $crop[1] / (double) $crop[2];
         if ($this->request->query->has('width')) {
             $realFitSize = [(int) $this->request->query->get('width'), round($this->request->query->get('width') / $fitRatio)];
         } elseif ($this->request->query->has('height')) {
             $realFitSize = [round($this->request->query->get('height') * $fitRatio), (int) $this->request->query->get('height')];
         }
         $image->fit($realFitSize[0], $realFitSize[1], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
开发者ID:ambroisemaupate,项目名称:intervention-request,代码行数:14,代码来源:CropResizedProcessor.php

示例9: fit

 protected function fit()
 {
     if ($this->width !== null || $this->height !== null) {
         if ($this->fit === self::FIT_CROP && $this->width && $this->height) {
             $this->image->fit($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
             });
             return;
         }
         if ($this->fit === self::FIT_MIN || $this->fit === self::FIT_MAX) {
             if ($this->fit === self::FIT_MAX) {
                 $this->image->resize($this->width, $this->height, function ($constraint) {
                     /* @var $constraint \Intervention\Image\Constraint */
                     $constraint->aspectRatio();
                     $constraint->upsize();
                 });
                 $this->image->resizeCanvas($this->width, $this->height, 'top-left');
             }
             if ($this->fit === self::FIT_MIN) {
                 $height = $this->image->getHeight() < $this->height ? $this->image->getHeight() : $this->height;
                 $width = $this->image->getWidth() < $this->width ? $this->image->getWidth() : $this->width;
                 $this->image->fit($width, $height, function ($constraint) {
                     /* @var $constraint \Intervention\Image\Constraint */
                     $constraint->aspectRatio();
                     $constraint->upsize();
                 });
             }
             return;
         }
         if ($this->fit === self::FIT_CLIP) {
             $this->image->resize($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
                 $constraint->upsize();
             });
             return;
         }
         if ($this->fit === self::FIT_SCALE) {
             $this->image->resize($this->width, $this->height);
             return;
         }
         if ($this->fit === self::FIT_CLAMP) {
             $this->image->resize($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
             });
         }
     }
 }
开发者ID:Monori,项目名称:imgback,代码行数:50,代码来源:ImageHandler.php

示例10: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(480, 320);
 }
开发者ID:stjanilofts,项目名称:ofncms,代码行数:4,代码来源:kubburFilter.php

示例11: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(480, 360)->insert(storage_path('app/public/wm-large.png'), 'bottom-right', 5, 5);
 }
开发者ID:Dimimo,项目名称:Booklet,代码行数:4,代码来源:WatermarkLarge.php

示例12: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700)->contrast(-15)->brightness(15)->gamma(2);
 }
开发者ID:stjanilofts,项目名称:gicms,代码行数:4,代码来源:frontpagebannerFilter.php

示例13: applyFilter

 /**
  * Applies filter to given image
  *
  * @param  \Intervention\Image\Image $image
  *
  * @return \Intervention\Image\Image
  */
 public function applyFilter(\Intervention\Image\Image $image)
 {
     // TODO: Implement applyFilter() method.
     return $image->fit(900, 475);
 }
开发者ID:vjcspy,项目名称:izcore,代码行数:12,代码来源:ArticleTitleImage.php

示例14: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700)->greyscale()->blur(30)->contrast(-60)->brightness(-30);
 }
开发者ID:stjanilofts,项目名称:ofncms,代码行数:4,代码来源:productbgFilter.php

示例15: applyFilter

 public function applyFilter(Image $image)
 {
     return $image->fit(500, 375);
 }
开发者ID:jasonraimondi,项目名称:twitterclone,代码行数:4,代码来源:Medium.php


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