2012-06-22 1 views
0

나는 투명해야하며 어디에도 해결책이 없는데 PNG 이미지가 검은 색으로 변하는 사람들과 함께 많은 다른 실을 보았습니다.투명한 PNG가는 검은 색

어쩌면 코드에서 어디에서 잘못 될까요? 어쩌면 imagealhpablending 내 웹 서버에서 지원하지?

도움을 주실 수있는 분들께 고마워요.

 $photo = imagecreatefrompng("{$thumb_folder}{$new_file_name}"); 
     $width = imagesx($photo); 
     $height = imagesy($photo); 

     $new_width = 32; 
     $new_height = floor($height/($width/$new_width)); 

     $temp_photo = imagecreatetruecolor($new_width, $new_height); 

     imagealphablending($temp_photo, false); 

     imagesavealpha($temp_photo, true); 

     $transparent = imagecolorallocatealpha($temp_photo, 255, 255, 255, 127); 

     imagefilledrectangle($temp_photo, 0, 0, $new_width, $new_height, $transparent); 

     imagecopyresampled($temp_photo, $photo, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 

     imagepng($temp_photo, "{$thumb_folder}{$new_file_name}"); 

답변

0

이미지에 할당 된 첫 번째 색상은 항상 배경색이므로 어쨌든 채워진 사각형을 그릴 필요가 없습니다. 코드에서 제거하고 얻은 것을 확인하십시오.