summaryrefslogtreecommitdiffstats
path: root/frontends/php/image.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-03-14 15:21:27 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-03-14 15:21:27 +0000
commit25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6 (patch)
tree01e08dad83c7671bb8a19b9c40f2f786b033d99e /frontends/php/image.php
parentf35b829723124ac2c15defd1d5cce44b40b1c8ec (diff)
downloadzabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.tar.gz
zabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.tar.xz
zabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.zip
- added "Data overview" for screens
- added "Triggers overview" for screens (Eugene) - added blinking into Trigger overview (Eugene) - added screen displaying in other screen (Eugene) - improved Overview table header, vertical text added (Eugene) - developed "ZABBIX Clock" module for screens (Eugene) - developed "ZABBIX server info" module for screens (Eugene) - developed "Triggers info" module for screens (Eugene) - developed "Host info" module for screens (Eugene) - improved screens displaying, added item alignment (Eugene) - improved ZABBIX server report (Eugene) - improved images configuration (Eugene) - added onserver image resizing for thumbs by php (Eugene) - developed acknowledges system (Eugene) - added icons displaying for maps (Eugene) - added maps displaying for maps (Eugene) - improved maps (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@2699 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/image.php')
-rw-r--r--frontends/php/image.php77
1 files changed, 73 insertions, 4 deletions
diff --git a/frontends/php/image.php b/frontends/php/image.php
index 16e3076b..c4d3bca2 100644
--- a/frontends/php/image.php
+++ b/frontends/php/image.php
@@ -20,21 +20,90 @@
?>
<?php
include "include/config.inc.php";
+?>
+<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "imageid"=> array(T_ZBX_INT, O_MAND,P_SYS, DB_ID, NULL),
+ "width"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(1,2000), NULL),
+ "height"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(1,2000), NULL),
+ );
+ check_fields($fields);
+?>
+<?php
# PARAMETERS:
# imageid
-# Header( "Content-type: text/html");
+// Header( "Content-type: text/html");
Header( "Content-type: image/png");
Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT");
check_authorisation();
+ $resize = 0;
+
+ if(isset($_REQUEST["width"]) || isset($_REQUEST["height"]))
+ {
+ $resize = 1;
+ $th_width = get_request("width",0);
+ $th_height = get_request("height",0);
+ }
+
$result=DBselect("select image from images where imageid=".$_REQUEST["imageid"]);
$row=DBfetch($result);
- $image=ImageCreateFromString($row["image"]);
- ImageOut($image);
- ImageDestroy($image);
+ if($row["image"] == "") exit;
+
+ $source = ImageCreateFromString($row["image"]);
+
+ if($resize == 1)
+ {
+ $src_width = imagesx($source);
+ $src_height = imagesy($source);
+
+ if($src_width > $th_width || $src_height > $th_height){
+ if($th_width == 0)
+ {
+ $th_width = $th_height * $src_width/$src_height;
+ } else if($th_height == 0)
+ {
+ $th_height = $th_width * $src_height/$src_width;
+ } else {
+ $a = $th_width/$th_height;
+ $b = $src_width/$src_height;
+
+ if($a > $b){
+ $th_width = $b * $th_height;
+ $th_height = $th_height;
+ } else {
+ $th_height = $th_width/$b;
+ $th_width = $th_width;
+ }
+ }
+
+ if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1))
+ {
+ $thumb = imagecreatetruecolor($th_width,$th_height);
+ }
+ else
+ {
+ $thumb = imagecreate($th_width,$th_height);
+ }
+
+ imagecopyresized(
+ $thumb, $source,
+ 0, 0,
+ 0, 0,
+ $th_width, $th_height,
+ $src_width, $src_height);
+
+ ImageOut($thumb);
+ ImageDestroy($thumb);
+ exit;
+ }
+ }
+ ImageOut($source);
+ ImageDestroy($source);
?>