This commit is contained in:
kuaifan
2023-06-14 17:22:03 +08:00
parent 4845e2e6a6
commit fd33eb3d1c
87 changed files with 614 additions and 595 deletions

View File

@@ -2509,17 +2509,24 @@ class Base
$src = $createfun($src_img);
$dst = imagecreatetruecolor($width ?: $dst_w, $height ?: $dst_h);
try {
$white = imagecolorallocate($dst, 255, 255, 255);
imagefill($dst, 0, 0, $white);
} catch (\Throwable) {
}
if (function_exists('imagecopyresampled')) {
imagecopyresampled($dst, $src, $x, $y, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
} else {
imagecopyresized($dst, $src, $x, $y, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
}
try {
if ($type == 'png') {
imagesavealpha($dst, true);
$transparent = imagecolorallocatealpha($dst, 0, 0, 0, 127);
imagefill($dst, 0, 0, $transparent);
} else {
$white = imagecolorallocate($dst, 255, 255, 255);
imagefill($dst, 0, 0, $white);
}
} catch (\Throwable) {
}
$otfunc($dst, $dst_img);
imagedestroy($dst);
imagedestroy($src);