Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function crop($width, $height, $offset_x = null, $offset_y = null)
 {
     switch ($offset_x) {
         case 'left':
             $offset_x = 0;
             break;
         case 'right':
             $offset_x = (int) ($this->getWidth() - $width);
             break;
         case 'center':
             $offset_x = (int) (($this->getWidth() - $width) / 2);
             break;
     }
     switch ($offset_y) {
         case 'top':
             $offset_y = 0;
             break;
         case 'bottom':
             $offset_y = (int) ($this->getHeight() - $height);
             break;
         case 'middle':
             $offset_y = (int) (($this->getHeight() - $height) / 2);
             break;
     }
     return parent::crop($width, $height, $offset_x, $offset_y);
 }