mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Don't use imagedestroy() in PHP 8.0 or higher
This commit is contained in:
parent
2eaf869eba
commit
950b1c4074
1 changed files with 29 additions and 8 deletions
|
|
@ -656,9 +656,15 @@ class FileHandler
|
|||
$resize_needed = true;
|
||||
$thumb = imagecreatetruecolor($resize_width, $resize_height);
|
||||
if (!$thumb)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '8.0', '<'))
|
||||
{
|
||||
imagedestroy($source);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -719,8 +725,10 @@ class FileHandler
|
|||
imagecopyresampled($thumb, $source, $dst_x, $dst_y, 0, 0, $dst_width, $dst_height, $width, $height);
|
||||
}
|
||||
|
||||
imagedestroy($source);
|
||||
if (version_compare(PHP_VERSION, '8.0', '>='))
|
||||
{
|
||||
unset($source);
|
||||
}
|
||||
|
||||
// create directory
|
||||
self::makeDir(dirname($target_file));
|
||||
|
|
@ -751,15 +759,28 @@ class FileHandler
|
|||
$output = imagewebp($thumb, $target_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '8.0', '<'))
|
||||
{
|
||||
imagedestroy($thumb);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($thumb);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@chmod($target_file, 0666 & ~Rhymix\Framework\Storage::getUmask());
|
||||
|
||||
if (version_compare(PHP_VERSION, '8.0', '<'))
|
||||
{
|
||||
imagedestroy($thumb);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($thumb);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue