コード例 #1
0
ファイル: Resize.php プロジェクト: atikahmed/joomla-probid
 /**
  * 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
0
ファイル: image.php プロジェクト: ZyXelP/oxwall
 /**
  * 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;
 }