[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Canvas/GD/ -> PNG.php (source)

   1  <?php
   2  
   3  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   4  
   5  /**
   6   * Image_Canvas
   7   *
   8   * Canvas class to handle PNG format.
   9   *
  10   * PHP versions 4 and 5
  11   *
  12   * LICENSE: This library is free software; you can redistribute it and/or modify
  13   * it under the terms of the GNU Lesser General Public License as published by
  14   * the Free Software Foundation; either version 2.1 of the License, or (at your
  15   * option) any later version. This library is distributed in the hope that it
  16   * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  17   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  18   * General Public License for more details. You should have received a copy of
  19   * the GNU Lesser General Public License along with this library; if not, write
  20   * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21   * 02111-1307 USA
  22   *
  23   * @category   Images
  24   * @package    Image_Canvas
  25   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  26   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  27   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  28   * @version    CVS: $Id: PNG.php,v 1.3 2005/08/24 20:37:34 nosey Exp $
  29   * @link       http://pear.php.net/pepr/pepr-proposal-show.php?id=212
  30   */
  31   
  32  /**
  33   * Include file Image/Canvas/GD.php
  34   */
  35  require_once  'Image/Canvas/GD.php';
  36  
  37  /**
  38   * PNG Canvas class.
  39   * 
  40   * @category   Images
  41   * @package    Image_Canvas
  42   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  43   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  44   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  45   * @version    Release: @package_version@
  46   * @link       http://pear.php.net/pepr/pepr-proposal-show.php?id=212
  47   */
  48  class Image_Canvas_GD_PNG extends Image_Canvas_GD
  49  {
  50  
  51      /**
  52       * Create the PNG canvas
  53       *
  54       * @param array $param Parameter array
  55       */
  56      function Image_Canvas_GD_PNG($param)
  57      {
  58          parent::Image_Canvas_GD($param);
  59  
  60          if ((isset($param['transparent'])) && ($param['transparent']) &&
  61              ($this->_gd2)
  62          ) {
  63              if ($param['transparent'] === true) {
  64                  $transparent = '#123ABD';
  65              } else {
  66                  $transparent = $param['transparent'];
  67              }
  68              $color = $this->_color($transparent);
  69              $trans = ImageColorTransparent($this->_canvas, $color);
  70  
  71              $this->rectangle(
  72                  array(
  73                      'x0' => $this->_left,
  74                      'y0' => $this->_top,
  75                      'x1' => $this->_left + $this->_width - 1,
  76                      'y1' => $this->_top + $this->_height - 1,
  77                      'fill' => 'opague',
  78                      'line' => 'transparent'
  79                  )
  80              );
  81          } else {
  82              $this->rectangle(
  83                  array(
  84                      'x0' => $this->_left,
  85                      'y0' => $this->_top,
  86                      'x1' => $this->_left + $this->_width - 1,
  87                      'y1' => $this->_top + $this->_height - 1,
  88                      'fill' => 'white',
  89                      'line' => 'transparent'
  90                  )
  91              );
  92          }
  93      }
  94  
  95      /**
  96       * Output the result of the canvas
  97       *
  98       * @param array $param Parameter array
  99       * @abstract
 100       */
 101      function show($param = false)
 102      {
 103          parent::show($param);
 104          header('Content-type: image/png');
 105          header('Content-Disposition: inline; filename = \"'. basename($_SERVER['PHP_SELF'], '.php') . '.png\"');
 106          ImagePNG($this->_canvas);
 107          ImageDestroy($this->_canvas);       
 108      }
 109  
 110          /**
 111       * Output the result of the canvas
 112       *
 113       * @param array $param Parameter array
 114       * @abstract
 115       */
 116      function save($param = false)
 117      {
 118          parent::save($param);
 119          ImagePNG($this->_canvas, $param['filename']);
 120          ImageDestroy($this->_canvas);
 121      }
 122  
 123  }
 124  
 125  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7