Skip to content

Commit

Permalink
Merge multiple PRs (#756)
Browse files Browse the repository at this point in the history
* Ayesh: [PHP 8.4] Fix: Curl CURLOPT_BINARYTRANSFER deprecated #675

* THenkeDE: SVG detection fix for inline data images #646

* bruno-farias:  Fix count svg #647
  • Loading branch information
nicolaasuni authored Oct 26, 2024
1 parent dad9e91 commit 01c96e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/tcpdf_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,6 @@ public static function fileGetContents($file) {
// try to get remote file data using cURL
$crs = curl_init();
curl_setopt($crs, CURLOPT_URL, $path);
curl_setopt($crs, CURLOPT_BINARYTRANSFER, true);
curl_setopt($crs, CURLOPT_FAILONERROR, true);
curl_setopt($crs, CURLOPT_RETURNTRANSFER, true);
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
Expand Down
6 changes: 3 additions & 3 deletions tcpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -19055,7 +19055,7 @@ protected function openHTMLTagHandler($dom, $key, $cell) {
if ($imgsrc[0] === '@') {
// data stream
$imgsrc = '@'.base64_decode(substr($imgsrc, 1));
$type = '';
$type = preg_match('/<svg([^\>]*)>/si', $imgsrc) ? 'svg' : '';
} else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) {
$imgsrc = '@'.base64_decode($reg[2]);
$type = $reg[1];
Expand Down Expand Up @@ -23445,8 +23445,8 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1
$cy -= $h;
}
$this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $this->k)));
if (count($gradient['stops']) > 1) {
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false);
if ((is_array($gradient['stops']) || $gradient['stops'] instanceof Countable) && count($gradient['stops']) > 1) {
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops']);
}
} elseif ($svgstyle['fill'] != 'none') {
$fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors);
Expand Down

0 comments on commit 01c96e8

Please sign in to comment.