admin 发表于 2022-10-22 07:12:12

Discuz修复PNG透明图片生成缩略图时背景变黑的BUG

解决手机版png透明图片黑底问题

打开 source\class\class_image.php

找到这个函数(所有修改都在这个函数内)
function Thumb_GD() {下边找到$copy_photo = imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']);imagecopy($copy_photo, $attach_photo , 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);$attach_photo = $copy_photo;改为
if($this->imginfo['mime'] != 'image/png') {      $copy_photo = imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']);      imagecopy($copy_photo, $attach_photo , 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);      $attach_photo = $copy_photo;}找到(三处)$thumb_photo = imagecreatetruecolor下边添加if($this->imginfo['mime'] == 'image/png') {      imagealphablending($thumb_photo, false);      imagesavealpha($thumb_photo, true);}

teliy 发表于 2023-1-30 14:56:22

dz论坛 png缩略图优化教程
页: [1]
查看完整版本: Discuz修复PNG透明图片生成缩略图时背景变黑的BUG

创宇盾启航版免费网站防御网站加速服务