Fix compatibility with ext-gd on php 8 (#1762)
This commit is contained in:
parent
8007872524
commit
607d3473e6
|
|
@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
- Fix for issue [#1735](https://github.com/PHPOffice/PhpSpreadsheet/issues/1735) Incorrect activeSheetIndex after RemoveSheetByIndex - [PR #1743](https://github.com/PHPOffice/PhpSpreadsheet/pull/1743)
|
- Fix for issue [#1735](https://github.com/PHPOffice/PhpSpreadsheet/issues/1735) Incorrect activeSheetIndex after RemoveSheetByIndex - [PR #1743](https://github.com/PHPOffice/PhpSpreadsheet/pull/1743)
|
||||||
- Ensure that the list of shared formulae is maintained when an xlsx file is chunked with readFilter[Issue #169](https://github.com/PHPOffice/PhpSpreadsheet/issues/1669).
|
- Ensure that the list of shared formulae is maintained when an xlsx file is chunked with readFilter[Issue #169](https://github.com/PHPOffice/PhpSpreadsheet/issues/1669).
|
||||||
- Fix for notice during accessing "cached magnification factor" offset [#1354](https://github.com/PHPOffice/PhpSpreadsheet/pull/1354)
|
- Fix for notice during accessing "cached magnification factor" offset [#1354](https://github.com/PHPOffice/PhpSpreadsheet/pull/1354)
|
||||||
|
- Fix compatibility with ext-gd on php 8
|
||||||
|
|
||||||
### Security Fix (CVE-2020-7776)
|
### Security Fix (CVE-2020-7776)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Shared;
|
namespace PhpOffice\PhpSpreadsheet\Shared;
|
||||||
|
|
||||||
|
use GdImage;
|
||||||
|
|
||||||
class Drawing
|
class Drawing
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
@ -152,7 +154,7 @@ class Drawing
|
||||||
*
|
*
|
||||||
* @param string $p_sFile Path to Windows DIB (BMP) image
|
* @param string $p_sFile Path to Windows DIB (BMP) image
|
||||||
*
|
*
|
||||||
* @return resource
|
* @return GdImage|resource
|
||||||
*/
|
*/
|
||||||
public static function imagecreatefrombmp($p_sFile)
|
public static function imagecreatefrombmp($p_sFile)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Worksheet;
|
namespace PhpOffice\PhpSpreadsheet\Worksheet;
|
||||||
|
|
||||||
|
use GdImage;
|
||||||
|
|
||||||
class MemoryDrawing extends BaseDrawing
|
class MemoryDrawing extends BaseDrawing
|
||||||
{
|
{
|
||||||
// Rendering functions
|
// Rendering functions
|
||||||
|
|
@ -19,7 +21,7 @@ class MemoryDrawing extends BaseDrawing
|
||||||
/**
|
/**
|
||||||
* Image resource.
|
* Image resource.
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var GdImage|resource
|
||||||
*/
|
*/
|
||||||
private $imageResource;
|
private $imageResource;
|
||||||
|
|
||||||
|
|
@ -62,7 +64,7 @@ class MemoryDrawing extends BaseDrawing
|
||||||
/**
|
/**
|
||||||
* Get image resource.
|
* Get image resource.
|
||||||
*
|
*
|
||||||
* @return resource
|
* @return GdImage|resource
|
||||||
*/
|
*/
|
||||||
public function getImageResource()
|
public function getImageResource()
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +74,7 @@ class MemoryDrawing extends BaseDrawing
|
||||||
/**
|
/**
|
||||||
* Set image resource.
|
* Set image resource.
|
||||||
*
|
*
|
||||||
* @param resource $value
|
* @param GdImage|resource $value
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
|
||||||
|
|
||||||
|
use GdImage;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\DataValidation;
|
use PhpOffice\PhpSpreadsheet\Cell\DataValidation;
|
||||||
|
|
@ -2254,7 +2255,7 @@ class Worksheet extends BIFFwriter
|
||||||
*/
|
*/
|
||||||
public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1): void
|
public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1): void
|
||||||
{
|
{
|
||||||
$bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap));
|
$bitmap_array = (is_resource($bitmap) || $bitmap instanceof GdImage ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap));
|
||||||
[$width, $height, $size, $data] = $bitmap_array;
|
[$width, $height, $size, $data] = $bitmap_array;
|
||||||
|
|
||||||
// Scale the frame of the image.
|
// Scale the frame of the image.
|
||||||
|
|
@ -2460,7 +2461,7 @@ class Worksheet extends BIFFwriter
|
||||||
/**
|
/**
|
||||||
* Convert a GD-image into the internal format.
|
* Convert a GD-image into the internal format.
|
||||||
*
|
*
|
||||||
* @param resource $image The image to process
|
* @param GdImage|resource $image The image to process
|
||||||
*
|
*
|
||||||
* @return array Array with data and properties of the bitmap
|
* @return array Array with data and properties of the bitmap
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue