You are here

function PHPExcel_Writer_Excel5_Worksheet::insertBitmap in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php \PHPExcel_Writer_Excel5_Worksheet::insertBitmap()

* Insert a 24bit bitmap image in a worksheet. * * @access public *

Parameters

integer $row The row we are going to insert the bitmap into: * @param integer $col The column we are going to insert the bitmap into * @param mixed $bitmap The bitmap filename or GD-image resource * @param integer $x The horizontal position (offset) of the image inside the cell. * @param integer $y The vertical position (offset) of the image inside the cell. * @param float $scale_x The horizontal scale * @param float $scale_y The vertical scale

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php, line 2366

Class

PHPExcel_Writer_Excel5_Worksheet
PHPExcel_Writer_Excel5_Worksheet

Code

function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) {
  $bitmap_array = is_resource($bitmap) ? $this
    ->_processBitmapGd($bitmap) : $this
    ->_processBitmap($bitmap);
  list($width, $height, $size, $data) = $bitmap_array;

  //$this->_processBitmap($bitmap);

  // Scale the frame of the image.
  $width *= $scale_x;
  $height *= $scale_y;

  // Calculate the vertices of the image and write the OBJ record
  $this
    ->_positionImage($col, $row, $x, $y, $width, $height);

  // Write the IMDATA record to store the bitmap data
  $record = 0x7f;
  $length = 8 + $size;
  $cf = 0x9;
  $env = 0x1;
  $lcb = $size;
  $header = pack("vvvvV", $record, $length, $cf, $env, $lcb);
  $this
    ->_append($header . $data);
}