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


PHP ImageHandler::createImageHandlerFromFileExtension方法代碼示例

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


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

示例1: _chooseLogoFile

 /**
  * return the logo image which fits the best to the size of the map
  *
  * @return resource
  */
 private function _chooseLogoFile()
 {
     $mapWidth = imagesx($this->_img);
     $mapHeight = imagesy($this->_img);
     foreach ($this->_logoFiles as $logoFile) {
         $logoImageHandler = ImageHandler::createImageHandlerFromFileExtension($logoFile);
         $logoImage = $logoImageHandler->loadImage($logoFile);
         $logoWidth = imagesx($logoImage);
         $logoHeight = imagesy($logoImage);
         if ($logoWidth < $mapWidth && $logoHeight < $mapHeight) {
             return $logoImage;
         }
     }
     return $logoImage;
 }
開發者ID:pafciu17,項目名稱:gsoc-os-static-maps-api,代碼行數:20,代碼來源:LogoMap.php

示例2: draw

 /**
  * draw point on map
  *
  * @param Map $map
  */
 public function draw(Map $map)
 {
     $image = $map->getImage();
     $color = $this->_getDrawColor($image);
     $pointImage = false;
     if ($this->hasImageUrl()) {
         $size = HelpClass::getSizeOfRemoteFile($this->_imageUrl->getUrl());
         if ($size <= self::$maxSizeOfPointImage) {
             try {
                 $imageHandler = ImageHandler::createImageHandlerFromFileExtension($this->_imageUrl->getUrl());
                 $pointImage = $imageHandler->loadImage($this->_imageUrl->getUrl());
             } catch (ImageHandlerException $e) {
             }
         }
     }
     if ($pointImage !== false) {
         $map->putImage($pointImage, $this->getLon(), $this->getLat());
     } else {
         $color = $this->_getDrawColor($image);
         $point = $map->getPixelPointFromCoordinates($this->getLon(), $this->getLat());
         $vertices = array($point['x'], $point['y'], $point['x'] - 10, $point['y'] - 20, $point['x'] + 10, $point['y'] - 20);
         imagefilledpolygon($map->getImage(), $vertices, 3, $color);
     }
 }
開發者ID:pafciu17,項目名稱:gsoc-os-static-maps-api,代碼行數:29,代碼來源:MarkPoint.php

示例3: __construct

 public function __construct($fileName)
 {
     $this->setImageHandler(ImageHandler::createImageHandlerFromFileExtension($fileName));
     parent::__construct($this->_imageHandler->loadImage($fileName));
 }
開發者ID:pafciu17,項目名稱:gsoc-os-static-maps-api,代碼行數:5,代碼來源:WrongRequestMap.php


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