當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Library::getContentsFromGDResource方法代碼示例

本文整理匯總了PHP中Library::getContentsFromGDResource方法的典型用法代碼示例。如果您正苦於以下問題:PHP Library::getContentsFromGDResource方法的具體用法?PHP Library::getContentsFromGDResource怎麽用?PHP Library::getContentsFromGDResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Library的用法示例。


在下文中一共展示了Library::getContentsFromGDResource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public function save($quality = 100)
 {
     $contents = Library::getContentsFromGDResource($this->resource, $this->format, $quality);
     $format = $this->format;
     $extension = $this->getExtensionFromFormat($format);
     $mime = $this->getMimeFromFormat($format);
     return array('contents' => $contents, 'format' => $format, 'extension' => $extension, 'mime' => $mime);
 }
開發者ID:feeel1,項目名稱:akina,代碼行數:8,代碼來源:Output.php

示例2: setFrames

 protected function setFrames()
 {
     foreach ($this->background->frames as $framekey => $frame) {
         if ($framekey === 0 || $frame['disposalmethod'] === '010' || $this->background->frames[$framekey - 1]['disposalmethod'] === '010') {
             $resource = imagecreatetruecolor($this->background->width, $this->background->height);
             if (isset($this->fill) === true) {
                 $backgroundindex = imagecolorallocate($resource, $this->fill['red'], $this->fill['green'], $this->fill['blue']);
                 imagefill($resource, 0, 0, $backgroundindex);
             } else {
                 $backgroundindex = imagecolorallocatealpha($resource, 255, 255, 255, 127);
                 imagefill($resource, 0, 0, $backgroundindex);
                 imagecolortransparent($resource, $backgroundindex);
             }
             imagecopy($resource, $frame['resource'], 0, 0, 0, 0, $this->background->width, $this->background->height);
             if (isset($this->layersresource) === true) {
                 imagecopy($resource, $this->layersresource, 0, 0, 0, 0, $this->background->width, $this->background->height);
             }
         } else {
             $resource = imagecreatetruecolor($this->background->width, $this->background->height);
             $transparentindex = imagecolorallocatealpha($resource, 255, 255, 255, 127);
             imagefill($resource, 0, 0, $transparentindex);
             imagecolortransparent($resource, $transparentindex);
             imagecopy($resource, $frame['resource'], 0, 0, 0, 0, $this->background->width, $this->background->height);
             if (isset($this->layersresource) === true) {
                 if (isset($this->layerscoordinates) === false) {
                     $this->setLayersCoordinates();
                 }
                 imagealphablending($resource, false);
                 foreach ($this->layerscoordinates as $layerscoordinate) {
                     imagesetpixel($resource, $layerscoordinate['x'], $layerscoordinate['y'], $transparentindex);
                 }
             }
         }
         $this->frames[$framekey]['disposalmethod'] = $frame['disposalmethod'];
         $this->frames[$framekey]['delaytime'] = $frame['delaytime'];
         $contents = Library::getContentsFromGDResource($resource, 'gif');
         $this->frames[$framekey]['fileobject'] = Library::getFileObjectFromContents($contents);
     }
 }
開發者ID:leotaillard,項目名稱:btws2016,代碼行數:39,代碼來源:OutputGIF.php


注:本文中的Library::getContentsFromGDResource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。