本文整理汇总了PHP中CreateImageHandle函数的典型用法代码示例。如果您正苦于以下问题:PHP CreateImageHandle函数的具体用法?PHP CreateImageHandle怎么用?PHP CreateImageHandle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateImageHandle函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Circular_Diagram
function Circular_Diagram($ImageHandle, $arr, $background_color, $diameter, $centerX, $centerY, $antialiase = true)
{
if ($antialiase) {
$ImageHandle_Saved = $ImageHandle;
$diameter_saved = $diameter;
$diameter = $diameter * 5;
$centerX = $centerX * 5;
$centerY = $centerY * 5;
$ImageHandle = CreateImageHandle($diameter, $diameter, "FFFFFF", true);
//Заливаем фон
imagefill($ImageHandle, 0, 0, imagecolorallocate($ImageHandle, 255, 255, 255));
}
$arr2 = array();
$diameterX = $diameter;
$diameterY = intval($diameter * 0.6);
if (count($arr) > 0) {
$sum = 0;
foreach ($arr as $sector) {
$sum += $sector["COUNTER"];
}
$degree1 = 0;
$p = 0.0;
$i = 0;
foreach ($arr as $sector) {
$p += $sector["COUNTER"] / $sum * 360.0;
++$i;
if ($i == count($arr)) {
$degree2 = 360;
} else {
$degree2 = intval($p);
}
if ($degree2 > $degree1) {
$dec = ReColor($sector["COLOR"]);
$arr2[] = array("DEGREE_1" => $degree1, "DEGREE_2" => $degree2, "COLOR" => $sector["COLOR"], "IMAGE_COLOR" => ImageColorAllocate($ImageHandle, $dec[0], $dec[1], $dec[2]), "IMAGE_DARK" => ImageColorAllocate($ImageHandle, $dec[0] / 1.5, $dec[1] / 1.5, $dec[2] / 1.5));
$degree1 = $degree2;
}
}
if (count($arr2) > 0) {
$h = 15;
if ($antialiase) {
$h = $h * 5;
}
for ($i = 0; $i <= $h; $i++) {
foreach ($arr2 as $sector) {
$degree1 = $sector["DEGREE_1"];
$degree2 = $sector["DEGREE_2"];
$difference = $degree2 - $degree1;
$degree1 -= 180;
$degree1 = $degree1 < 0 ? 360 + $degree1 : $degree1;
$degree2 -= 180;
$degree2 = $degree2 < 0 ? 360 + $degree2 : $degree2;
$color = $i == $h ? $sector["IMAGE_COLOR"] : $sector["IMAGE_DARK"];
if ($difference == 360) {
imageellipse($ImageHandle, $centerX, $centerY - $i, $diameterX, $diameterY, $color);
} else {
imagearc($ImageHandle, $centerX, $centerY - $i, $diameterX, $diameterY, $degree1, $degree2, $color);
}
}
}
$i--;
foreach ($arr2 as $sector) {
$degree1 = $sector["DEGREE_1"];
$degree2 = $sector["DEGREE_2"];
$difference = $degree2 - $degree1;
$degree1 -= 180;
$degree1 = $degree1 < 0 ? 360 + $degree1 : $degree1;
$degree2 -= 180;
$degree2 = $degree2 < 0 ? 360 + $degree2 : $degree2;
$color = $i == $h ? $sector["IMAGE_COLOR"] : $sector["IMAGE_DARK"];
if ($difference == 360) {
imagefilledellipse($ImageHandle, $centerX, $centerY - $i, $diameterX, $diameterY, $color);
} else {
imagefilledarc($ImageHandle, $centerX, $centerY - $i, $diameterX, $diameterY, $degree1, $degree2, $color, IMG_ARC_PIE);
}
}
}
} else {
$dec = ReColor($background_color);
$color = ImageColorAllocate($ImageHandle, $dec[0], $dec[1], $dec[2]);
imagefilledellipse($ImageHandle, $centerX, $centerY, $diameterX, $diameterY, $color);
}
if ($antialiase) {
/** @noinspection PhpUndefinedVariableInspection */
imagecopyresampled($ImageHandle_Saved, $ImageHandle, 0, 0, 0, 0, $diameter_saved, $diameter_saved, $diameter, $diameter);
}
}
示例2: intval
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/colors.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
$width = intval($_GET["width"]);
$max_width = COption::GetOptionInt("statistic", "GRAPH_WEIGHT");
if ($width <= 0 || $width > $max_width) {
$width = $max_width;
}
$height = intval($_GET["height"]);
$max_height = COption::GetOptionInt("statistic", "GRAPH_HEIGHT");
if ($height <= 0 || $height > $max_height) {
$height = $max_height;
}
// create image
$ImageHandle = CreateImageHandle($width, $height);
$arrX = array();
// data points X
$arrY = array();
// data points Y
$arrayX = array();
// axis X
$arrayY = array();
// axis Y
/******************************************************
Get data
*******************************************************/
$str = is_array($find_country_id) ? implode(" | ", $find_country_id) : "";
$arF = array("COUNTRY_ID" => $str, "DATE1" => $find_date1, "DATE2" => $find_date2);
$arrDays = CCountry::GetGraphArray($arF, $arrLegend);
reset($arrDays);
示例3: while
$arrMess["2_m"] = 0;
$arrMess["3_m"] = 0;
$arrMess["4_m"] = 0;
$arrMess["5_m"] = 0;
$arrMess["6_m"] = 0;
$arrMess["7_m"] = 0;
$arrMess["8_m"] = 0;
$arrMess["9_m"] = 0;
$arrMess["10_m"] = 0;
while ($arTicket = $rsTickets->Fetch()) {
if (strlen($arTicket["DATE_CLOSE"]) > 0) {
$MC = $arTicket["MESSAGES"];
if ($MC <= 2) {
$arrMess["2_m"] += 1;
} elseif ($MC >= 10) {
$arrMess["10_m"] += 1;
} else {
$arrMess[$MC . "_m"] += 1;
}
}
}
$arr = array();
while (list($key, $value) = each($arrMess)) {
$arr[] = array("COLOR" => $arrColor[$key], "COUNTER" => $arrMess[$key]);
}
// создаем изображение
$ImageHendle = CreateImageHandle($diameter, $diameter);
// рисуем круговую диаграмму
Circular_Diagram($ImageHendle, $arr, "FFFFFF", $diameter, $diameter / 2, $diameter / 2);
// отображаем
ShowImageHeader($ImageHendle);
示例4: foreach
$arFind["find_allow_delivery_" . $k1] = ${"find_allow_delivery_" . $k1};
}
if (${"find_canceled_" . $k1} == "Y") {
$arFind["find_canceled_" . $k1] = ${"find_canceled_" . $k1};
}
foreach ($arStatus as $k2 => $v2) {
if (${"find_status_" . $k2} == "Y") {
$arFind["find_status_" . $k2] = ${"find_status_" . $k2};
}
if (${"find_status_" . $k2 . "_" . $k1} == "Y") {
$arFind["find_status_" . $k2 . "_" . $k1] = ${"find_status_" . $k2 . "_" . $k1};
}
}
}
// create image canvas
$ImageHandle = CreateImageHandle($width, $height, "FFFFFF", true);
$colorFFFFFF = ImageColorAllocate($ImageHandle, 255, 255, 255);
ImageFill($ImageHandle, 0, 0, $colorFFFFFF);
$arrayX = array();
$arrayY = array();
$arFilter = array();
/******************************************************
Plot data
*******************************************************/
if (strlen($filter_date_from) > 0) {
$arFilter["DATE_FROM"] = Trim($filter_date_from);
}
if (strlen($filter_date_to) > 0) {
if ($arDate = ParseDateTime($filter_date_to, CSite::GetDateFormat("FULL", SITE_ID))) {
if (StrLen($filter_date_to) < 11) {
$arDate["HH"] = 23;
示例5: FormDecode
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/tools.php";
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/colors.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
if (function_exists("FormDecode")) {
FormDecode();
}
UnQuoteAll();
// создаем изображение
$ImageHendle = CreateImageHandle(45, 2);
$dec = ReColor($color);
$color = ImageColorAllocate($ImageHendle, $dec[0], $dec[1], $dec[2]);
if ($dash == "Y") {
$style = array($color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
//$white = ImageColorAllocate($ImageHendle,255,255,255);
//$style = array ($color,$color,$white,$white,$white);
ImageSetStyle($ImageHendle, $style);
ImageLine($ImageHendle, 3, 0, 40, 0, IMG_COLOR_STYLED);
ImageLine($ImageHendle, 1, 1, 40, 1, IMG_COLOR_STYLED);
} else {
ImageLine($ImageHendle, 3, 0, 40, 0, $color);
ImageLine($ImageHendle, 3, 1, 40, 1, $color);
}
/******************************************************
ќтображаем изображение
*******************************************************/
ShowImageHeader($ImageHendle);
示例6: min
}
} else {
$errorCode = 46;
}
} else {
$errorCode = 45;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="paint pie diagram">
if ($errorCode === 0) {
$diameter = min($width, $height);
$imageHandle = $ImageHandle = CreateImageHandle($diameter, $diameter);
Circular_Diagram($imageHandle, $arData, $backgroundColor, $diameter, round($diameter / 2), round($diameter / 2));
$h = $diameter * 0.6;
$dh = 15;
$imageHandleTemp = CreateImageHandle($diameter, $h + $dh);
imagecopy($imageHandleTemp, $imageHandle, 0, 0, 0, ($diameter - $h) / 2 - $dh, $diameter, $h + $dh);
imagedestroy($imageHandle);
$imageHandle = $imageHandleTemp;
}
// </editor-fold>
} else {
$errorCode = 44;
}
// At least one value is required
} else {
$errorCode = 41;
}
}
}
if ($errorCode === 0) {
示例7: Copyright
# Copyright (c) 2004 Bitrix #
# http://www.bitrix.ru #
# mailto:admin@bitrix.ru #
##############################################
*/
define("STOP_STATISTICS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
$STAT_RIGHT = $APPLICATION->GetGroupRight("statistic");
if ($STAT_RIGHT == "D") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/colors.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
$diameter = COption::GetOptionString("statistic", "DIAGRAM_DIAMETER");
// create image
$ImageHandle = CreateImageHandle($diameter, $diameter, "FFFFFF", true);
// get plot data
$arr = array();
$arFilter = array("ID" => implode(" | ", $find_events), "DATE1_PERIOD" => $find_date1, "DATE2_PERIOD" => $find_date2);
if (strlen($find_date1) > 0 || strlen($find_date2) > 0) {
$period = "Y";
}
$by = $period == "Y" ? "s_period_counter" : "s_total_counter";
$w = CStatEventType::GetList($by, $order = "desc", $arFilter, $is_filtered);
while ($wr = $w->Fetch()) {
$total++;
$count = $period == "Y" ? $wr["PERIOD_COUNTER"] : $wr["TOTAL_COUNTER"];
if ($count > 0) {
$arr[] = array("COUNTER" => $count);
}
}