本文整理汇总了PHP中WideImage_Image::resize方法的典型用法代码示例。如果您正苦于以下问题:PHP WideImage_Image::resize方法的具体用法?PHP WideImage_Image::resize怎么用?PHP WideImage_Image::resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WideImage_Image
的用法示例。
在下文中一共展示了WideImage_Image::resize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Apply the manipulation with the setup options to the passed in image.
* This does not do any memory manipulation
*
* @param WideImage_Image $image
* @return WideImage_Image
*/
public function &apply(WideImage_Image &$image)
{
if (!$this->isSetup()) {
throw new RokGallery_Manipulation_Exception(rc__('ROKGALLERY_MANIPULATION_WAS_NOT_SETUP_PRIOR_TO_APPLYING'));
}
$return_image = $image->resize($this->width, $this->height);
return $return_image;
}
示例2: resizeImage
/**
* Resizes image
*
* @param int $width
* @param int $height
* @param boolean $crop
*
* @return UTIL_Image
*/
public function resizeImage($width, $height, $crop = false)
{
$iWidth = $this->image->getWidth();
$iHeight = $this->image->getHeight();
$this->imageResized = $width <= $iWidth || isset($height) && $height <= $iHeight ? true : false;
if ($width == null) {
$width = $iWidth;
} else {
$width = $width > $iWidth ? $iWidth : $width;
}
if ($height == null) {
$height = $iHeight;
} else {
$height = $height > $iHeight ? $iHeight : $height;
}
if ($crop) {
$wHalf = ceil($width / 2);
$hHalf = ceil($height / 2);
$this->image = $this->image->resize($width, $height, 'outside')->crop('50%-' . $wHalf, '50%-' . $hHalf, $width, $height);
} else {
$this->image = $this->image->resize($width, $height);
}
return $this;
}