/** * sets the output path for the thumbnail. * if image must not be resized, it will set the path of the original image * * @return void * @private */ private function setOutputPath() { if ((!$this->useOriginalSize() || !$this->hasOriginalType()) && we_base_imageEdit::gd_version() > 0 && we_base_imageEdit::is_imagetype_supported($this->outputFormat) && we_base_imageEdit::is_imagetype_read_supported(isset(we_base_imageEdit::$GDIMAGE_TYPE[strtolower($this->imageExtension)]) ? we_base_imageEdit::$GDIMAGE_TYPE[strtolower($this->imageExtension)] : '')) { $this->outputPath = self::getThumbDirectory() . '/' . $this->imageID . '_' . $this->thumbID . '_' . $this->imageFileName . '.' . $this->outputFormat; } else { $this->outputPath = $this->imagePath; } }
function convert($type, $quality = 8) { if (!is_numeric($quality)) { return false; } list($width, $height) = $this->getOrigSize(); $quality = max(min($quality, 10), 0) * 10; $dataPath = TEMP_PATH . we_base_file::getUniqueId(); we_base_imageEdit::edit_image($this->getElement('data'), $type, $dataPath, $quality, $width, $height, false); $this->setElement('data', $dataPath); $this->Extension = '.' . $type; $this->Text = $this->Filename . $this->Extension; $this->Path = $this->getParentPath() . $this->Text; $this->DocChanged = true; }