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