getTransferAdapter()->getResize(); } public function setResize($spec) { $this->getTransferAdapter()->setResize($spec); return $this; } public function setThumbnailWidth($width) { $this->_thumbnailWidth = (int) $width; return $this; } public function setThumbnailHeight($height) { $this->_thumbnailHeight = (int) $height; return $this; } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return $this; } $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('ExtendedImage') ->addDecorator('Errors') ->addDecorator('Description') ->addDecorator('HtmlTag', array('tag' => 'dd', 'id' => $this->getName() . '-element')) ->addDecorator('Label', array('tag' => 'dt')); } return $this; } public function getDownloadUrl() { if (null === $this->_downloadUrl) { $file = $this->getTransferAdapter()->getDestination($this->getName()) . '/' . $this->getValue(); $file = str_replace(WWW_PATH . '/' . Qs_ImageFs::WEB_PATH . '/', '', $file); $this->_downloadUrl = BASE_URL . '/' . Qs_ImageFs::get($file); } return $this->_downloadUrl; } public function getThumbnail() { if (null === $this->_thumbnail) { $file = $this->getTransferAdapter()->getDestination($this->getName()) . '/' . $this->getValue(); $file = str_replace(WWW_PATH . '/' . Qs_ImageFs::WEB_PATH . '/', '', $file); $this->_thumbnail = Qs_ImageFs::get($file, $this->_thumbnailWidth, $this->_thumbnailHeight); } return $this->_thumbnail; } public function isValid($value, $context = null) { $this->getValidators(); // autoinsert IsImage validator return parent::isValid($value, $context); } public function getValidators() { if (null == $this->getValidator('IsImage')) { $this->addValidator('File_IsImage', true); } return parent::getValidators(); } }