本文整理汇总了PHP中Intervention\Image\Image::widen方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::widen方法的具体用法?PHP Image::widen怎么用?PHP Image::widen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intervention\Image\Image
的用法示例。
在下文中一共展示了Image::widen方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Image $image)
{
if ($this->request->query->has('width') && 1 === preg_match('#^([0-9]+)$#', $this->request->query->get('width'), $width)) {
$image->widen($width[1], function (Constraint $constraint) {
$constraint->upsize();
});
}
}
示例2: scale
/**
* Scales an image to the given width and height while maintaining aspect ratio.
*
* The resulting image can be smaller for one or both target dimensions.
*
* @param int $width
* The target width, in pixels. This value is omitted then the scaling will
* based only on the height value.
* @param int $height
* The target height, in pixels. This value is omitted then the scaling will
* based only on the width value.
*/
public function scale($width = null, $height = null)
{
if ($width === null && $height === null) {
throw new \LogicException('one of "width" or "height" must be set for "scale"');
}
if ($width !== null && $height !== null) {
$this->resize($width, $height);
return;
}
if ($width !== null) {
$this->image->widen($width);
return;
}
$this->image->heighten($height);
}
示例3: applyFilter
public function applyFilter(Image $image)
{
return $image->widen(640)->crop(640, 420);
}
示例4: applyFilter
public function applyFilter(Image $image)
{
return $image->widen(800);
}
示例5: widen
/**
* Resize image to new width, constraining proportions
*
* @param integer $width
* @return \Intervention\Image\Image
* @static
*/
public static function widen($width)
{
return \Intervention\Image\Image::widen($width);
}
示例6: applyFilter
public function applyFilter(Image $image)
{
return $image->widen(Config::get('builder::watermark.width'))->insert(Config::get("builder::watermark.path_watermark"), Config::get("builder::watermark.position"), Config::get("builder::watermark.x"), Config::get("builder::watermark.y"));
}
示例7: 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);
$callback = isset($options['callback']) ? $options['callback'] : null;
return $image->widen($options['width'], $callback);
}