久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

Discuz! 官方交流社區(qū)

標(biāo)題: Discuz修復(fù)PNG透明圖片生成縮略圖時(shí)背景變黑的BUG [打印本頁]

作者: 1314學(xué)習(xí)網(wǎng)    時(shí)間: 2022-10-22 01:07
標(biāo)題: Discuz修復(fù)PNG透明圖片生成縮略圖時(shí)背景變黑的BUG
解決手機(jī)版png透明圖片黑底問題

打開 source\class\class_image.php

找到這個(gè)函數(shù)(所有修改都在這個(gè)函數(shù)內(nèi))
  1. function Thumb_GD() {
復(fù)制代碼
下邊找到
  1. $copy_photo = imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']);
  2. imagecopy($copy_photo, $attach_photo , 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);
  3. $attach_photo = $copy_photo;
復(fù)制代碼
改為
  1. if($this->imginfo['mime'] != 'image/png') {
  2.         $copy_photo = imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']);
  3.         imagecopy($copy_photo, $attach_photo , 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);
  4.         $attach_photo = $copy_photo;
  5. }
復(fù)制代碼
找到(三處)
  1. $thumb_photo = imagecreatetruecolor
復(fù)制代碼
下邊添加
  1. if($this->imginfo['mime'] == 'image/png') {
  2.         imagealphablending($thumb_photo, false);
  3.         imagesavealpha($thumb_photo, true);
  4. }
復(fù)制代碼


作者: ysx24    時(shí)間: 2022-10-23 14:55
史詩級攻略,修復(fù)我頭疼一年多的頑疾,感謝




歡迎光臨 Discuz! 官方交流社區(qū) (http://www.9999xn.com/) Powered by Discuz! W1.0