Esempio n. 1
0
 /**
  * Create a new resize filter with the given options
  *
  * @param Zend_Config|array $options Some options. You may specify: width,
  * height, keepRatio, keepSmaller (do not resize image if it is smaller than
  * expected), directory (save thumbnail to another directory),
  * adapter (the name or an instance of the desired adapter)
  * @throws Zend_Filter_Exception
  * @return \Skoch\Filter\File\Crop An instance of this filter
  */
 public function __construct($options)
 {
     $options = parent::__construct($options);
     if (isset($options['x1'])) {
         $this->xValue1 = $options['x1'];
     }
     if (isset($options['y1'])) {
         $this->yValue1 = $options['y1'];
     }
     if (isset($options['x'])) {
         $this->xValue = $options['x'];
     }
     if (isset($options['y'])) {
         $this->yValue = $options['y'];
     }
     if (isset($options['thumbwidth'])) {
         $this->_thumbwidth = $options['thumbwidth'];
     }
     if (isset($options['directory'])) {
         $this->directory = $options['directory'];
     }
     if (isset($options['prefix'])) {
         $this->prefix = $options['prefix'];
     }
     $this->evaluateAdapter($options);
     $this->prepareAdapter();
 }
Esempio n. 2
0
 /**
  * Create a new resize filter with the given options
  *
  * @param Zend_Config|array $options Some options. You may specify: width,
  * height, keepRatio, keepSmaller (do not resize image if it is smaller than
  * expected), directory (save thumbnail to another directory),
  * adapter (the name or an instance of the desired adapter)
  * @throws Zend_Filter_Exception
  * @return \Skoch\Filter\File\Resize An instance of this filter
  */
 public function __construct($options)
 {
     $options = parent::__construct($options);
     if (!isset($options['width']) && !isset($options['height'])) {
         throw new Zend_Filter_Exception('At least one of width or height must be defined');
     }
     if (isset($options['width'])) {
         $this->width = $options['width'];
     }
     if (isset($options['height'])) {
         $this->height = $options['height'];
     }
     if (isset($options['keepRatio'])) {
         $this->keepRatio = $options['keepRatio'];
     }
     if (isset($options['keepSmaller'])) {
         $this->keepSmaller = $options['keepSmaller'];
     }
     if (isset($options['directory'])) {
         $this->directory = $options['directory'];
     }
     $this->evaluateAdapter($options);
     $this->prepareAdapter();
 }