[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 $phpwcms = array(); 24 require_once('../../../config/phpwcms/conf.inc.php'); 25 require_once ('../../../include/inc_lib/default.inc.php'); 26 27 $img_file = (isset($_GET['i'])) ? rawurldecode($_GET['i']) : ''; 28 $img_quality = (isset($_GET['q']) && intval($_GET['q']) <= 100 && intval($_GET['q'])) ? intval($_GET['q']) : 85; 29 $img_info = getimagesize(PHPWCMS_TEMPLATE.'inc_cntpart/map/map_img/'.$img_file); 30 31 $img_val = (isset($_GET['v'])) ? explode(',', $_GET['v']) : array(1,7,7,'FFFFFF','FF4000'); 32 $img_val[0] = intval($img_val[0]); // border in px 33 $img_val[1] = empty($img_val[1]) ? 0 : intval($img_val[1]); // width in px 34 $img_val[2] = empty($img_val[2]) ? 0 : intval($img_val[2]); // height in px 35 $img_val[3] = empty($img_val[3]) ? hex2rgb('FFFFFF') : hex2rgb($img_val[3]); // background color array RGB 36 $img_val[4] = empty($img_val[4]) ? hex2rgb('FF4000') : hex2rgb($img_val[4]); // fill color array RGB 37 38 $img_val[5] = round($img_val[1]/2); // position -x 39 $img_val[6] = round($img_val[2]/2); // position -y 40 41 $img_val[7] = $img_val[1] - (2 * $img_val[0]); // width inner fill 42 $img_val[8] = $img_val[2] - (2 * $img_val[0]); // height inner fill 43 44 45 46 $do = 0; 47 48 //print_r($img_info); 49 50 if($img_info) { 51 52 $img_file = PHPWCMS_TEMPLATE.'inc_cntpart/map/map_img/'.$img_file; 53 54 switch($img_info[2]) { 55 56 case 1: // GIF 57 if(function_exists('imagegif')) { 58 $img_mimetype = 'image/gif'; 59 $img_target = 'gif'; 60 } else { 61 $img_mimetype = 'image/png'; 62 $img_target = 'png'; 63 } 64 $img_source = imagecreatefromgif($img_file); 65 $do = 1; 66 break; 67 68 case 2: // JPG 69 $img_mimetype = 'image/jpeg'; 70 $img_target = 'jpg'; 71 $img_source = imagecreatefromjpeg($img_file); 72 $do = 1; 73 break; 74 75 case 3: // PNG 76 $img_mimetype = 'image/png'; 77 $img_target = 'png'; 78 $img_source = imagecreatefrompng($img_file); 79 $do = 1; 80 break; 81 82 } 83 84 // fill image with points 85 $img_point = imagecreate($img_val[1], $img_val[2]); 86 $background_color = imagecolorallocate($img_point, $img_val[3]['r'], $img_val[3]['g'], $img_val[3]['b']); 87 $fill_color = imagecolorallocate($img_point, $img_val[4]['r'], $img_val[4]['g'], $img_val[4]['b']); 88 imagefilledrectangle($img_point,$img_val[0], $img_val[0], $img_val[7], $img_val[8], $fill_color); 89 90 if(isset($_GET['xy'])) { 91 $points = explode(',', trim($_GET['xy'])); 92 if(count($points)) { 93 foreach($points as $value) { 94 $point = explode('x', $value); 95 imagecopymerge($img_source, $img_point, $point[0]-$img_val[5], $point[1]-$img_val[6], 0, 0, $img_val[1], $img_val[2], 100); 96 } 97 } 98 } 99 imagedestroy($img_point); 100 101 } 102 103 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 104 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); 105 header("Cache-Control: no-store, no-cache, must-revalidate"); 106 header("Cache-Control: post-check=0, pre-check=0",false); 107 header("Pragma: no-cache"); 108 109 if($do) { 110 111 header('Content-type: '.$img_mimetype); 112 113 switch($img_target) { 114 115 case 'jpg': imagejpeg($img_source, '', $img_quality); 116 break; 117 118 case 'png': imagepng($img_source, '', 9); 119 break; 120 121 case 'gif': imagegif($img_source); 122 break; 123 124 } 125 126 imagedestroy($img_source); 127 128 } else { 129 130 // error / no image 131 header ('Content-type: image/png'); 132 $new_img = imagecreatetruecolor(75, 20); 133 $text_color = imagecolorallocate($new_img, 255, 255, 255); 134 imagestring($new_img, 1, 5, 5, "Image Error", $text_color); 135 imagepng($new_img, '', 9); 136 imagedestroy($new_img); 137 138 } 139 140 function hex2rgb($hex) { 141 $color = trim(str_replace('#','',$hex)); 142 $rgb = array('r' => intval(hexdec(substr($color,0,2))), 143 'g' => intval(hexdec(substr($color,2,2))), 144 'b' => intval(hexdec(substr($color,4,2))) 145 ); 146 return $rgb; 147 } 148 149 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |