示例#1
0
文件: Image.php 项目: nabble/ajde
 public function process()
 {
     switch ($this->_attributeParse()) {
         case 'base64':
             $image = new Ajde_Resource_Image($this->attributes['filename']);
             $image->setWidth(issetor($this->attributes['width']));
             $image->setHeight(issetor($this->attributes['height']));
             $image->setCrop(Ajde_Component_String::toBoolean(issetor($this->attributes['crop'], true)));
             $controller = Ajde_Controller::fromRoute(new Ajde_Core_Route('_core/component:imageBase64'));
             $controller->setImage($image);
             $controller->setWidth(issetor($this->attributes['width'], null));
             $controller->setHeight(issetor($this->attributes['height'], null));
             $controller->setExtraClass(issetor($this->attributes['class'], ''));
             return $controller->invoke();
             break;
         case 'html':
             return self::getImageTag($this->attributes['filename'], issetor($this->attributes['width']), issetor($this->attributes['height']), Ajde_Component_String::toBoolean(issetor($this->attributes['crop'], true)), issetor($this->attributes['class'], ''), issetor($this->attributes['lazy'], false), issetor($this->attributes['absoluteUrl'], false));
             break;
         case 'image':
             return false;
             break;
     }
     // TODO:
     throw new Ajde_Component_Exception('Missing required attributes for component call');
 }
示例#2
0
文件: Embed.php 项目: nabble/ajde
 public function process()
 {
     switch ($this->_attributeParse()) {
         case 'render':
             $image = new Ajde_Resource_Image($this->attributes['filename']);
             $image->setWidth($this->attributes['width']);
             $image->setHeight($this->attributes['height']);
             $image->setCrop(Ajde_Component_String::toBoolean($this->attributes['crop']));
             $controller = Ajde_Controller::fromRoute(new Ajde_Core_Route('_core/component:imageBase64'));
             $controller->setImage($image);
             $controller->setWidth(issetor($this->attributes['width'], null));
             $controller->setHeight(issetor($this->attributes['height'], null));
             $controller->setExtraClass(issetor($this->attributes['class'], ''));
             return $controller->invoke();
             break;
     }
     // TODO:
     throw new Ajde_Component_Exception('Missing required attributes for component call');
 }