JamesHeinrich / phpThumb

phpThumb() - The PHP thumbnail generator
Other
315 stars 98 forks source link

Bad call to $this inside static function - phpthumb.functions.php gd_info() & phpThumb.php SendSaveAsFileHeaderIfNeeded() #168

Closed dleffler closed 3 years ago

dleffler commented 3 years ago

As a note, in line 1003 of the current phpthumb.functions.php code, the following won't work since it's not called from within the object $this;

@chmod($tempfilename, $this->getParameter('config_file_create_mask'));

possible fix is

$phpthumb = new phpthumb();
@chmod($tempfilename, $phpthumb->getParameter('config_file_create_mask'));

Additionally this same error occurs within phpThumb.php at line 44 which also references $this

$downloadfilename = phpthumb_functions::SanitizeFilename((!empty($phpThumb->src) ? basename($phpThumb->src) : md5($this->rawImageData)).'-'.intval($getimagesize[0]).'x'.intval($getimagesize[1]).'.'.(!empty($_GET['f']) ? $_GET['f'] : 'jpg'));

possible fix is

$downloadfilename = phpthumb_functions::SanitizeFilename((!empty($phpThumb->src) ? basename($phpThumb->src) : md5($phpThumb->rawImageData)).'-'.intval($getimagesize[0]).'x'.intval($getimagesize[1]).'.'.(!empty($_GET['f']) ? $_GET['f'] : 'jpg'));
JamesHeinrich commented 3 years ago

Changed in https://github.com/JamesHeinrich/phpThumb/commit/a2f5546b2aa502dc08e80a2ca8fca0ae342da5b0