paristemi
[ class tree: paristemi ] [ index: paristemi ] [ all elements ]

Source for file createimage.php

Documentation is available at createimage.php

  1. <?php
  2. /**
  3. * <b>Create Image</b><br />
  4. * This is called from business logic to display a contact person's email address.
  5. * @author Kristen O'Brien <kristen_paristemi-com>
  6. * @copyright Copyright 2004, Kristen O'Brien
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. * @link http://www.paristemi.com Paristemi Main Site
  9. * @package paristemi
  10. * @subpackage paristemi_util
  11. * @since Build 0.5
  12. * @version Build 0.7
  13. * @filesource
  14. */
  15. /**
  16. * Include the constants file and all of the files in the include list
  17. */
  18. if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
  19. if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
  20. else { require_once("../constants.php"); }
  21. }
  22. else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
  23. foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
  24.  
  25. $db = new Database();
  26.  
  27. $imgtype="";$id="";$area="";$width=200;$height=32;
  28. $bgcolor="255,255,255";$tcolor="0,0,255";$font=2;$x_coor=5;$y_coor=5;
  29. if(isset($HTTP_GET_VARS['imgtype'])) { $imgtype = $HTTP_GET_VARS['imgtype']; }
  30. if(isset($HTTP_GET_VARS['id'])) { $id = $HTTP_GET_VARS['id']; }
  31. if(isset($HTTP_GET_VARS['area'])) { $area = $HTTP_GET_VARS['area']; }
  32. if(isset($HTTP_GET_VARS['width'])) { $width = $HTTP_GET_VARS['width']; }
  33. if(isset($HTTP_GET_VARS['height'])) { $height = $HTTP_GET_VARS['height']; }
  34. if(isset($HTTP_GET_VARS['bgcolor'])) { $bgcolor = $HTTP_GET_VARS['bgcolor']; }
  35. if(isset($HTTP_GET_VARS['textcolor'])) { $tcolor = $HTTP_GET_VARS['textcolor']; }
  36. if(isset($HTTP_GET_VARS['font'])) { $font = $HTTP_GET_VARS['font']; }
  37. if(isset($HTTP_GET_VARS['x'])) { $x_coor = $HTTP_GET_VARS['x']; }
  38. if(isset($HTTP_GET_VARS['y'])) { $y_coor = $HTTP_GET_VARS['y']; }
  39. switch($area) {
  40. case 'contact' : $db_contact = $db->GetClass('contact');
  41. $data =& $db_contact->GetContactData($id);
  42. $text = $data->Email; break;
  43. default : $text = ""; break;
  44. }
  45. $header = "Content-type: image/".$imgtype;
  46. header($header);
  47. $im = @imagecreate($width,$height);
  48. $bgcolorarr = explode(",",$bgcolor);
  49. $tcolorarr = explode(",",$tcolor);
  50. $background_color = imagecolorallocate($im,$bgcolorarr[0],$bgcolorarr[1],$bgcolorarr[2]);
  51. $text_color = imagecolorallocate($im,$tcolorarr[0],$tcolorarr[1],$tcolorarr[2]);
  52. imagestring($im,$font,$x_coor,$y_coor,$text,$text_color);
  53. switch($imgtype) {
  54. case 'png' : imagepng($im); break;
  55. case 'jpg' : imagejpeg($im); break;
  56. case 'jpeg' : imagejpeg($im); break;
  57. case 'gif' : imagegif($im); break;
  58. default : break;
  59. }
  60. imagedestroy ($im);
  61. ?>

Documentation generated on Mon, 10 May 2004 12:08:07 -0700 by phpDocumentor 1.3.0RC3