- <?php
- /**
- * <b>Create Image</b><br />
- * This is called from business logic to display a contact person's email address.
- * @author Kristen O'Brien <kristen_paristemi-com>
- * @copyright Copyright 2004, Kristen O'Brien
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @link http://www.paristemi.com Paristemi Main Site
- * @package paristemi
- * @subpackage paristemi_util
- * @since Build 0.5
- * @version Build 0.7
- * @filesource
- */
- /**
- * Include the constants file and all of the files in the include list
- */
- if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
- if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
- else { require_once("../constants.php"); }
- }
- else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
- foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
-
- $db = new Database();
-
- $imgtype="";$id="";$area="";$width=200;$height=32;
- $bgcolor="255,255,255";$tcolor="0,0,255";$font=2;$x_coor=5;$y_coor=5;
- if(isset($HTTP_GET_VARS['imgtype'])) { $imgtype = $HTTP_GET_VARS['imgtype']; }
- if(isset($HTTP_GET_VARS['id'])) { $id = $HTTP_GET_VARS['id']; }
- if(isset($HTTP_GET_VARS['area'])) { $area = $HTTP_GET_VARS['area']; }
- if(isset($HTTP_GET_VARS['width'])) { $width = $HTTP_GET_VARS['width']; }
- if(isset($HTTP_GET_VARS['height'])) { $height = $HTTP_GET_VARS['height']; }
- if(isset($HTTP_GET_VARS['bgcolor'])) { $bgcolor = $HTTP_GET_VARS['bgcolor']; }
- if(isset($HTTP_GET_VARS['textcolor'])) { $tcolor = $HTTP_GET_VARS['textcolor']; }
- if(isset($HTTP_GET_VARS['font'])) { $font = $HTTP_GET_VARS['font']; }
- if(isset($HTTP_GET_VARS['x'])) { $x_coor = $HTTP_GET_VARS['x']; }
- if(isset($HTTP_GET_VARS['y'])) { $y_coor = $HTTP_GET_VARS['y']; }
-
- switch($area) {
- case 'contact' : $db_contact = $db->GetClass('contact');
- $data =& $db_contact->GetContactData($id);
- $text = $data->Email; break;
- default : $text = ""; break;
- }
-
- $header = "Content-type: image/".$imgtype;
- header($header);
- $im = @imagecreate($width,$height);
- $bgcolorarr = explode(",",$bgcolor);
- $tcolorarr = explode(",",$tcolor);
- $background_color = imagecolorallocate($im,$bgcolorarr[0],$bgcolorarr[1],$bgcolorarr[2]);
- $text_color = imagecolorallocate($im,$tcolorarr[0],$tcolorarr[1],$tcolorarr[2]);
- imagestring($im,$font,$x_coor,$y_coor,$text,$text_color);
- switch($imgtype) {
- case 'png' : imagepng($im); break;
- case 'jpg' : imagejpeg($im); break;
- case 'jpeg' : imagejpeg($im); break;
- case 'gif' : imagegif($im); break;
- default : break;
- }
- imagedestroy ($im);
- ?>