本文整理汇总了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');
}
示例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);
}
示例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;
}
示例4: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(1400, 700, function ($constraint) {
//$constraint->aspectRatio();
//$constraint->upsize();
})->encode('jpg', 70);
}
示例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();
});
}
}
示例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;
}
示例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);
}
示例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();
});
}
}
示例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();
});
}
}
}
示例10: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(480, 320);
}
示例11: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(480, 360)->insert(storage_path('app/public/wm-large.png'), 'bottom-right', 5, 5);
}
示例12: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(1400, 700)->contrast(-15)->brightness(15)->gamma(2);
}
示例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);
}
示例14: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(1400, 700)->greyscale()->blur(30)->contrast(-60)->brightness(-30);
}
示例15: applyFilter
public function applyFilter(Image $image)
{
return $image->fit(500, 375);
}