Skip to content

Commit

Permalink
Update phpthumb.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Jun 16, 2022
1 parent cdde823 commit 76e13e9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions phpthumb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class phpthumb {
public $issafemode = null;
public $php_memory_limit = null;

public $phpthumb_version = '1.7.18-202204131313';
public $phpthumb_version = '1.7.18-202206161832';

//////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -1010,6 +1010,7 @@ public function setOutputFormat() {
$AvailableImageOutputFormats = array_unique($AvailableImageOutputFormats);
$this->DebugMessage('$AvailableImageOutputFormats = array('.implode(';', $AvailableImageOutputFormats).')', __FILE__, __LINE__);

$this->f = (!empty($this->f) ? $this->f : '');
$this->f = preg_replace('#[^a-z]#', '', strtolower($this->f));
if (strtolower($this->config_output_format) == 'jpg') {
$this->config_output_format = 'jpeg';
Expand Down Expand Up @@ -3518,7 +3519,7 @@ public function ExtractEXIFgetImageSize() {

}

$this->DebugMessage('EXIF thumbnail extraction: (size='.(!empty($this->exif_thumbnail_data) ? strlen($this->exif_thumbnail_data) : 0).'; type="'.$this->exif_thumbnail_type.'"; '. (int) $this->exif_thumbnail_width .'x'. (int) $this->exif_thumbnail_height .')', __FILE__, __LINE__);
$this->DebugMessage('EXIF thumbnail extraction: (size='.(!empty($this->exif_thumbnail_data) ? strlen((string) $this->exif_thumbnail_data) : 0).'; type="'.$this->exif_thumbnail_type.'"; '. (int) $this->exif_thumbnail_width .'x'. (int) $this->exif_thumbnail_height .')', __FILE__, __LINE__);

// see if EXIF thumbnail can be used directly with no processing
if ($this->config_use_exif_thumbnail_for_speed && $this->exif_thumbnail_data) {
Expand Down Expand Up @@ -4194,8 +4195,8 @@ public function phpThumbDebug($level='') {
$value = $this->$varname;
$DebugOutput[] = '$this->'.str_pad($varname, 27, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value);
}
$DebugOutput[] = 'strlen($this->rawImageData) = '.strlen(@$this->rawImageData);
$DebugOutput[] = 'strlen($this->exif_thumbnail_data) = '.strlen(@$this->exif_thumbnail_data);
$DebugOutput[] = 'strlen($this->rawImageData) = '.(!empty($this->rawImageData) ? strlen($this->rawImageData) : '');
$DebugOutput[] = 'strlen($this->exif_thumbnail_data) = '.(!empty($this->exif_thumbnail_data) ? strlen($this->exif_thumbnail_data) : '');
$DebugOutput[] = '';

foreach ($ParameterNames as $varname) {
Expand Down Expand Up @@ -4476,6 +4477,15 @@ public function ImageCreateFromStringReplacement(&$RawImageData, $DieOnErrors=fa
}

public function ImageResizeFunction(&$dst_im, &$src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH) {
$dstX = (int) round($dstX);
$dstY = (int) round($dstY);
$srcX = (int) round($srcX);
$srcY = (int) round($srcY);
$dstW = (int) round($dstW);
$dstH = (int) round($dstH);
$srcW = (int) round($srcW);
$srcH = (int) round($srcH);

$this->DebugMessage('ImageResizeFunction($o, $s, '.$dstX.', '.$dstY.', '.$srcX.', '.$srcY.', '.$dstW.', '.$dstH.', '.$srcW.', '.$srcH.')', __FILE__, __LINE__);
if (($dstW == $srcW) && ($dstH == $srcH)) {
return imagecopy($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH);
Expand Down

0 comments on commit 76e13e9

Please sign in to comment.