예제 #1
0
파일: Image.php 프로젝트: bkwld/croppa
 /**
  * Do a quadrant adaptive resize.  Supported quadrant values are:
  * +---+---+---+
  * |   | T |   |
  * +---+---+---+
  * | L | C | R |
  * +---+---+---+
  * |   | B |   |
  * +---+---+---+
  *
  * @param integer $width
  * @param integer $height
  * @param array $options
  * @throws Exception
  * @return $this
  */
 public function cropQuadrant($width, $height, $options)
 {
     if (!$height || !$width) {
         throw new Exception('Croppa: Qudrant option needs width and height');
     }
     if (empty($options['quadrant'][0])) {
         throw new Exception('Croppa:: No quadrant specified');
     }
     $quadrant = strtoupper($options['quadrant'][0]);
     if (!in_array($quadrant, array('T', 'L', 'C', 'R', 'B'))) {
         throw new Exception('Croppa:: Invalid quadrant');
     }
     $this->thumb->adaptiveResizeQuadrant($width, $height, $quadrant);
     return $this;
 }