function PHPExcel_Writer_Excel5_Worksheet::_processBitmapGd in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php \PHPExcel_Writer_Excel5_Worksheet::_processBitmapGd()
* Convert a GD-image into the internal format. * * @access private *
Parameters
resource $image The image to process: * @return array Array with data and properties of the bitmap
1 call to PHPExcel_Writer_Excel5_Worksheet::_processBitmapGd()
- PHPExcel_Writer_Excel5_Worksheet::insertBitmap in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5/ Worksheet.php - * Insert a 24bit bitmap image in a worksheet. * * @access public *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5/ Worksheet.php, line 2583
Class
- PHPExcel_Writer_Excel5_Worksheet
- PHPExcel_Writer_Excel5_Worksheet
Code
function _processBitmapGd($image) {
$width = imagesx($image);
$height = imagesy($image);
$data = pack("Vvvvv", 0xc, $width, $height, 0x1, 0x18);
for ($j = $height; $j--;) {
for ($i = 0; $i < $width; ++$i) {
$color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
foreach (array(
"red",
"green",
"blue",
) as $key) {
$color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127);
}
$data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
}
if (3 * $width % 4) {
$data .= str_repeat("\0", 4 - 3 * $width % 4);
}
}
return array(
$width,
$height,
strlen($data),
$data,
);
}