本文整理汇总了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;
}
示例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);
}
}
示例3: __construct
public function __construct($fileName)
{
$this->setImageHandler(ImageHandler::createImageHandlerFromFileExtension($fileName));
parent::__construct($this->_imageHandler->loadImage($fileName));
}