You are here

class PHPExcel_Worksheet_MemoryDrawing in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/MemoryDrawing.php \PHPExcel_Worksheet_MemoryDrawing

PHPExcel_Worksheet_MemoryDrawing

@category PHPExcel @package PHPExcel_Worksheet @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

Hierarchy

Expanded class hierarchy of PHPExcel_Worksheet_MemoryDrawing

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/MemoryDrawing.php, line 36

View source
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable {

  /* Rendering functions */
  const RENDERING_DEFAULT = 'imagepng';
  const RENDERING_PNG = 'imagepng';
  const RENDERING_GIF = 'imagegif';
  const RENDERING_JPEG = 'imagejpeg';

  /* MIME types */
  const MIMETYPE_DEFAULT = 'image/png';
  const MIMETYPE_PNG = 'image/png';
  const MIMETYPE_GIF = 'image/gif';
  const MIMETYPE_JPEG = 'image/jpeg';

  /**
   * Image resource
   *
   * @var resource
   */
  private $_imageResource;

  /**
   * Rendering function
   *
   * @var string
   */
  private $_renderingFunction;

  /**
   * Mime type
   *
   * @var string
   */
  private $_mimeType;

  /**
   * Unique name
   *
   * @var string
   */
  private $_uniqueName;

  /**
   * Create a new PHPExcel_Worksheet_MemoryDrawing
   */
  public function __construct() {

    // Initialise values
    $this->_imageResource = null;
    $this->_renderingFunction = self::RENDERING_DEFAULT;
    $this->_mimeType = self::MIMETYPE_DEFAULT;
    $this->_uniqueName = md5(rand(0, 9999) . time() . rand(0, 9999));

    // Initialize parent
    parent::__construct();
  }

  /**
   * Get image resource
   *
   * @return resource
   */
  public function getImageResource() {
    return $this->_imageResource;
  }

  /**
   * Set image resource
   *
   * @param	$value resource
   * @return PHPExcel_Worksheet_MemoryDrawing
   */
  public function setImageResource($value = null) {
    $this->_imageResource = $value;
    if (!is_null($this->_imageResource)) {

      // Get width/height
      $this->_width = imagesx($this->_imageResource);
      $this->_height = imagesy($this->_imageResource);
    }
    return $this;
  }

  /**
   * Get rendering function
   *
   * @return string
   */
  public function getRenderingFunction() {
    return $this->_renderingFunction;
  }

  /**
   * Set rendering function
   *
   * @param string $value
   * @return PHPExcel_Worksheet_MemoryDrawing
   */
  public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
    $this->_renderingFunction = $value;
    return $this;
  }

  /**
   * Get mime type
   *
   * @return string
   */
  public function getMimeType() {
    return $this->_mimeType;
  }

  /**
   * Set mime type
   *
   * @param string $value
   * @return PHPExcel_Worksheet_MemoryDrawing
   */
  public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
    $this->_mimeType = $value;
    return $this;
  }

  /**
   * Get indexed filename (using image index)
   *
   * @return string
   */
  public function getIndexedFilename() {
    $extension = strtolower($this
      ->getMimeType());
    $extension = explode('/', $extension);
    $extension = $extension[1];
    return $this->_uniqueName . $this
      ->getImageIndex() . '.' . $extension;
  }

  /**
   * Get hash code
   *
   * @return string	Hash code
   */
  public function getHashCode() {
    return md5($this->_renderingFunction . $this->_mimeType . $this->_uniqueName . parent::getHashCode() . __CLASS__);
  }

  /**
   * Implement PHP __clone to create a deep clone, not just a shallow copy.
   */
  public function __clone() {
    $vars = get_object_vars($this);
    foreach ($vars as $key => $value) {
      if (is_object($value)) {
        $this->{$key} = clone $value;
      }
      else {
        $this->{$key} = $value;
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PHPExcel_Worksheet_BaseDrawing::$_coordinates protected property * Coordinates * *
PHPExcel_Worksheet_BaseDrawing::$_description protected property * Description * *
PHPExcel_Worksheet_BaseDrawing::$_height protected property * Height * * 1
PHPExcel_Worksheet_BaseDrawing::$_imageCounter private static property * Image counter * *
PHPExcel_Worksheet_BaseDrawing::$_imageIndex private property * Image index * *
PHPExcel_Worksheet_BaseDrawing::$_name protected property * Name * * 1
PHPExcel_Worksheet_BaseDrawing::$_offsetX protected property * Offset X * * 1
PHPExcel_Worksheet_BaseDrawing::$_offsetY protected property * Offset Y * * 1
PHPExcel_Worksheet_BaseDrawing::$_resizeProportional protected property * Proportional resize * * 1
PHPExcel_Worksheet_BaseDrawing::$_rotation protected property * Rotation * *
PHPExcel_Worksheet_BaseDrawing::$_shadow protected property * Shadow * *
PHPExcel_Worksheet_BaseDrawing::$_width protected property * Width * * 1
PHPExcel_Worksheet_BaseDrawing::$_worksheet protected property * Worksheet * *
PHPExcel_Worksheet_BaseDrawing::getCoordinates public function Get Coordinates
PHPExcel_Worksheet_BaseDrawing::getDescription public function Get Description
PHPExcel_Worksheet_BaseDrawing::getHeight public function Get Height 1
PHPExcel_Worksheet_BaseDrawing::getImageIndex public function Get image index
PHPExcel_Worksheet_BaseDrawing::getName public function Get Name 1
PHPExcel_Worksheet_BaseDrawing::getOffsetX public function Get OffsetX 1
PHPExcel_Worksheet_BaseDrawing::getOffsetY public function Get OffsetY 1
PHPExcel_Worksheet_BaseDrawing::getResizeProportional public function Get ResizeProportional 1
PHPExcel_Worksheet_BaseDrawing::getRotation public function Get Rotation
PHPExcel_Worksheet_BaseDrawing::getShadow public function Get Shadow
PHPExcel_Worksheet_BaseDrawing::getWidth public function Get Width 1
PHPExcel_Worksheet_BaseDrawing::getWorksheet public function Get Worksheet
PHPExcel_Worksheet_BaseDrawing::setCoordinates public function Set Coordinates
PHPExcel_Worksheet_BaseDrawing::setDescription public function Set Description
PHPExcel_Worksheet_BaseDrawing::setHeight public function Set Height 1
PHPExcel_Worksheet_BaseDrawing::setName public function Set Name 1
PHPExcel_Worksheet_BaseDrawing::setOffsetX public function Set OffsetX 1
PHPExcel_Worksheet_BaseDrawing::setOffsetY public function Set OffsetY 1
PHPExcel_Worksheet_BaseDrawing::setResizeProportional public function Set ResizeProportional 1
PHPExcel_Worksheet_BaseDrawing::setRotation public function Set Rotation
PHPExcel_Worksheet_BaseDrawing::setShadow public function Set Shadow
PHPExcel_Worksheet_BaseDrawing::setWidth public function Set Width 1
PHPExcel_Worksheet_BaseDrawing::setWidthAndHeight public function Set width and height with proportional resize * Example: * <code> * $objDrawing->setResizeProportional(true); * $objDrawing->setWidthAndHeight(160,120); * </code> * @author Vincent@luo MSN:kele_100@hotmail.com 1
PHPExcel_Worksheet_BaseDrawing::setWorksheet public function Set Worksheet
PHPExcel_Worksheet_MemoryDrawing::$_imageResource private property * Image resource * *
PHPExcel_Worksheet_MemoryDrawing::$_mimeType private property * Mime type * *
PHPExcel_Worksheet_MemoryDrawing::$_renderingFunction private property * Rendering function * *
PHPExcel_Worksheet_MemoryDrawing::$_uniqueName private property * Unique name * *
PHPExcel_Worksheet_MemoryDrawing::getHashCode public function * Get hash code * * Overrides PHPExcel_Worksheet_BaseDrawing::getHashCode
PHPExcel_Worksheet_MemoryDrawing::getImageResource public function Get image resource
PHPExcel_Worksheet_MemoryDrawing::getIndexedFilename public function Get indexed filename (using image index)
PHPExcel_Worksheet_MemoryDrawing::getMimeType public function Get mime type
PHPExcel_Worksheet_MemoryDrawing::getRenderingFunction public function Get rendering function
PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT constant
PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_GIF constant
PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG constant
PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG constant
PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT constant
PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF constant
PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG constant
PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG constant
PHPExcel_Worksheet_MemoryDrawing::setImageResource public function Set image resource
PHPExcel_Worksheet_MemoryDrawing::setMimeType public function Set mime type
PHPExcel_Worksheet_MemoryDrawing::setRenderingFunction public function Set rendering function
PHPExcel_Worksheet_MemoryDrawing::__clone public function * Implement PHP __clone to create a deep clone, not just a shallow copy. Overrides PHPExcel_Worksheet_BaseDrawing::__clone
PHPExcel_Worksheet_MemoryDrawing::__construct public function Create a new PHPExcel_Worksheet_MemoryDrawing Overrides PHPExcel_Worksheet_BaseDrawing::__construct