コード例 #1
0
 /**
  * creates the thumbnail and sets the binary data of the thumb to $thumbDataPointer
  *
  * @return int (WE_THUMB_OK, WE_THUMB_BUILDERROR, WE_THUMB_USE_ORIGINAL or WE_THUMB_NO_GDLIB_ERROR;
  * @param string &$thumbDataPointer Pointer to a string
  * @public
  */
 public function getThumb(&$thumbDataPointer)
 {
     if (we_base_imageEdit::gd_version() <= 0) {
         return self::NO_GDLIB_ERROR;
     }
     if ($this->useOriginalSize()) {
         return self::USE_ORIGINAL;
     }
     $quality = $this->thumbQuality < 1 ? 10 : ($this->thumbQuality > 10 ? 100 : $this->thumbQuality * 10);
     $outarr = we_base_imageEdit::edit_image($this->imageData ?: $_SERVER["DOCUMENT_ROOT"] . $this->imagePath, $this->outputFormat, "", $quality, $this->thumbWidth, $this->thumbHeight, $this->thumbRatio, $this->thumbInterlace, 0, 0, -1, -1, 0, $this->thumbFitinside);
     if ($outarr[0]) {
         $thumbDataPointer = $outarr[0];
         return self::OK;
     }
     return self::BUILDERROR;
 }
コード例 #2
0
 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;
 }