mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Add PR #163 small fixes in PWPNG class
Co-authored-by: horst-n <info@nogajski.de>
This commit is contained in:
@@ -25,7 +25,7 @@ class PWPNG {
|
|||||||
public function loadFile($lpszFileName) {
|
public function loadFile($lpszFileName) {
|
||||||
// READ FILE
|
// READ FILE
|
||||||
if(!($fh = @fopen($lpszFileName, 'rb'))) {
|
if(!($fh = @fopen($lpszFileName, 'rb'))) {
|
||||||
$this->Error('Can\'t open image file: '.$file);
|
$this->Error('Can\'t open image file: '.basename($lpszFileName));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$ret = (false === $this->_parsepngstream($fh, basename($lpszFileName))) ? false : true;
|
$ret = (false === $this->_parsepngstream($fh, basename($lpszFileName))) ? false : true;
|
||||||
@@ -59,6 +59,7 @@ class PWPNG {
|
|||||||
$colspace = 'Indexed';
|
$colspace = 'Indexed';
|
||||||
} else {
|
} else {
|
||||||
$this->Error('Unknown color type: '.$file);
|
$this->Error('Unknown color type: '.$file);
|
||||||
|
$colspace = '';
|
||||||
}
|
}
|
||||||
if(ord($this->_readstream($f, 1)) != 0) $this->Error('Unknown compression method: '.$file);
|
if(ord($this->_readstream($f, 1)) != 0) $this->Error('Unknown compression method: '.$file);
|
||||||
if(ord($this->_readstream($f, 1)) != 0) $this->Error('Unknown filter method: '.$file);
|
if(ord($this->_readstream($f, 1)) != 0) $this->Error('Unknown filter method: '.$file);
|
||||||
@@ -114,7 +115,7 @@ class PWPNG {
|
|||||||
'channels' => $ct,
|
'channels' => $ct,
|
||||||
'bits' => $bpc,
|
'bits' => $bpc,
|
||||||
'dp' => $dp,
|
'dp' => $dp,
|
||||||
'palette' => utf8_encode($pal),
|
'palette' => (function_exists('utf8_encode') ? utf8_encode($pal) : $pal),
|
||||||
'trans' => $trns,
|
'trans' => $trns,
|
||||||
'alpha' => $ct >= 4 ? true : false,
|
'alpha' => $ct >= 4 ? true : false,
|
||||||
'interlace' => $interlaced,
|
'interlace' => $interlaced,
|
||||||
@@ -131,7 +132,7 @@ class PWPNG {
|
|||||||
$s = fread($f, $n);
|
$s = fread($f, $n);
|
||||||
if($s === false) {
|
if($s === false) {
|
||||||
$this->Error('Error while reading stream');
|
$this->Error('Error while reading stream');
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
$n -= strlen($s);
|
$n -= strlen($s);
|
||||||
$res .= $s;
|
$res .= $s;
|
||||||
|
Reference in New Issue
Block a user