示例#1
0
	/**
	 * @param IImage
	 * @param IFormat
	 * @param string
	 * @param int
	 */
	public function actionImage(IImage $image, IFormat $format, $path, $type = NULL)
	{
		if ($format) {
			$image = $format->process($image);
		} else {
			$image = $image->toImage();
		}

		$path = $this->getContext()->params['wwwDir'] . $path;
		$dir = pathinfo($path, PATHINFO_DIRNAME);
		if (!file_exists($dir)) {
			mkdir($dir, 0777, TRUE);
		}

		$image->save($path);
		if (!$type) {
			$image->send();
		} else {
			$image->send($type);
		}

		$this->terminate();
	}
示例#2
0
 public function make(IFormat $formatMaker)
 {
     return $formatMaker->make($this);
 }
 /**
  * Get an instance
  *
  * @return  text.format.MoneyFormat
  */
 public function getInstance()
 {
     return parent::getInstance('MoneyFormat');
 }
 /**
  * Get an instance
  *
  * @return  text.format.ChoiceFormat
  */
 public function getInstance()
 {
     return parent::getInstance('ChoiceFormat');
 }
 /**
  * Get an instance
  *
  * @return  text.format.NumberFormat
  */
 public function getInstance()
 {
     return parent::getInstance('NumberFormat');
 }
 /**
  * Get an instance
  *
  * @return  text.format.PrintfFormat
  */
 public function getInstance()
 {
     return parent::getInstance('PrintfFormat');
 }
 /**
  * Get an instance
  *
  * @return  text.format.HashFormat
  */
 public function getInstance()
 {
     return parent::getInstance('HashFormat');
 }
 /**
  * Get an instance
  *
  * @return  text.format.MessageFormat
  */
 public function getInstance()
 {
     return parent::getInstance('MessageFormat');
 }