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

Source for file Drawing.php

Documentation is available at Drawing.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2011 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Worksheet_Drawing
  23.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.6, 2011-02-27
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Worksheet_Drawing
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Worksheet_Drawing
  34.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /**
  38.      * Path
  39.      *
  40.      * @var string 
  41.      */
  42.     private $_path;
  43.  
  44.     /**
  45.      * Create a new PHPExcel_Worksheet_Drawing
  46.      */
  47.     public function __construct()
  48.     {
  49.         // Initialise values
  50.         $this->_path                '';
  51.  
  52.         // Initialize parent
  53.         parent::__construct();
  54.     }
  55.  
  56.     /**
  57.      * Get Filename
  58.      *
  59.      * @return string 
  60.      */
  61.     public function getFilename({
  62.         return basename($this->_path);
  63.     }
  64.  
  65.     /**
  66.      * Get indexed filename (using image index)
  67.      *
  68.      * @return string 
  69.      */
  70.     public function getIndexedFilename({
  71.         $fileName $this->getFilename();
  72.         $fileName str_replace(' ''_'$fileName);
  73.         return str_replace('.' $this->getExtension()''$fileName$this->getImageIndex('.' $this->getExtension();
  74.     }
  75.  
  76.     /**
  77.      * Get Extension
  78.      *
  79.      * @return string 
  80.      */
  81.     public function getExtension({
  82.         $exploded explode("."basename($this->_path));
  83.         return $exploded[count($exploded1];
  84.     }
  85.  
  86.     /**
  87.      * Get Path
  88.      *
  89.      * @return string 
  90.      */
  91.     public function getPath({
  92.         return $this->_path;
  93.     }
  94.  
  95.     /**
  96.      * Set Path
  97.      *
  98.      * @param     string         $pValue            File path
  99.      * @param     boolean        $pVerifyFile    Verify file
  100.      * @throws     Exception
  101.      * @return PHPExcel_Worksheet_Drawing 
  102.      */
  103.     public function setPath($pValue ''$pVerifyFile true{
  104.         if ($pVerifyFile{
  105.             if (file_exists($pValue)) {
  106.                 $this->_path $pValue;
  107.  
  108.                 if ($this->_width == && $this->_height == 0{
  109.                     // Get width/height
  110.                     list($this->_width$this->_heightgetimagesize($pValue);
  111.                 }
  112.             else {
  113.                 throw new Exception("File $pValue not found!");
  114.             }
  115.         else {
  116.             $this->_path $pValue;
  117.         }
  118.         return $this;
  119.     }
  120.  
  121.     /**
  122.      * Get hash code
  123.      *
  124.      * @return string    Hash code
  125.      */
  126.     public function getHashCode({
  127.         return md5(
  128.               $this->_path
  129.             . parent::getHashCode()
  130.             . __CLASS__
  131.         );
  132.     }
  133.  
  134.     /**
  135.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  136.      */
  137.     public function __clone({
  138.         $vars get_object_vars($this);
  139.         foreach ($vars as $key => $value{
  140.             if (is_object($value)) {
  141.                 $this->$key clone $value;
  142.             else {
  143.                 $this->$key $value;
  144.             }
  145.         }
  146.     }
  147. }

Documentation generated on Sun, 27 Feb 2011 16:30:16 -0800 by phpDocumentor 1.4.3