コード例 #1
0
 public function perform(Zend_Image_Adapter_AdapterAbstract $adapter = null)
 {
     if (null === $adapter) {
         require_once 'Zend/Image/Action/Exception.php';
         throw new Zend_Image_Action_Exception('No adapter given.');
     }
     $name = 'Zend_Image_Adapter_' . $adapter->getName() . '_Action_' . $this->getName();
     Zend_Loader::loadClass($name);
     $actionObject = new $name();
     return $actionObject->perform($adapter, $this);
 }
コード例 #2
0
ファイル: DrawArc.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Get the location of the center of the arc
  *
  * @return Zend_Image_Point
  */
 public function getLocation(Zend_Image_Adapter_AdapterAbstract $adapter = null)
 {
     if ($adapter !== null) {
         if ($this->_pointCenter->getX() === null) {
             $this->_pointCenter->setX($adapter->getWidth() / 2);
         }
         if ($this->_pointCenter->getY() === null) {
             $this->_pointCenter->setY($adapter->getHeight() / 2);
         }
     }
     return $this->_pointCenter;
 }
コード例 #3
0
ファイル: Resize.php プロジェクト: BGCX262/zym-svn-to-git
 public function perform(Zend_Image_Adapter_AdapterAbstract $adapter)
 {
     $newX = $this->getXAmount();
     $newY = $this->getYAmount();
     if (null === $newX && null === $newY) {
         throw new Zend_Image_Action_Exception('No dimensions for resizing were specified, ' . 'at least one dimension should be specified.');
     }
     $constrain = $this->hasConstrainedProportions();
     if (null === $newX) {
         if ($constrain) {
             $newX = 0;
         } else {
             $newX = $adapter->getWidth();
         }
     } elseif (self::TYPE_RELATIVE == $this->getXType()) {
         $newX *= $adapter->getWidth() / 100;
     }
     if (null === $newY) {
         if ($constrain) {
             $newY = 0;
         } else {
             $newY = $adapter->getHeight();
         }
     } elseif (self::TYPE_RELATIVE == $this->getYType()) {
         $newY *= $adapter->getHeight() / 100;
     }
     $this->_yAmountCalculated = $newY;
     $this->_xAmountCalculated = $newX;
     return parent::perform($adapter);
 }