2011-03-07 4 views
0

을 유지하면서 여기에 보라 : http://tyilo.jbusers.com/PNG/progress.php?l=100&p=20결합 이미지 투명성

나는 파란색 부분의 끝 부분에 화이트 말았을 제거 할,하지만 작동하지 않았다 많은 다른 것들을 시도했다.

필요한 PNG 파일이 http://tyilo.jbusers.com/PNG/ 폴더 난 당신이 이미지의 알파 조화를 설정할 필요가 있다고 생각 (http://tyilo.jbusers.com/PNG/Empty.png)

header('Content-type: image/png'); 
echo imagepng(progressbar($_GET['l'], $_GET['p'])); 
function progressbar($length, $percentage) 
{ 
$length = round($length/2) * 2; 
$percentage = min(100, max(0, $percentage)); 
if($length > 0) 
{ 
    $bar = imagecreate($length, 14); 
    $empty = imagecreatefrompng('Empty.png'); 
    $fill = imagecreatefrompng('Fill.png'); 
    $lempty = imagecreatefrompng('LeftEmpty.png'); 
    $lfill = imagecreatefrompng('LeftFill.png'); 
    $rempty = imagecreatefrompng('RightEmpty.png'); 
    $rfill = imagecreatefrompng('RightFill.png'); 
    $emptycaplength = min(7, $length/2); //5 
    imagecopy($bar, $lempty, 0, 0, 0, 0, $emptycaplength, 14); 
    imagecopy($bar, $rempty, $length - $emptycaplength, 0, 7 - $emptycaplength, 0, $emptycaplength, 14); 
    if($length > 14) 
    { 
     imagecopyresized($bar, $empty, 7, 0, 0, 0, $length - 14, 14, 1, 14); 
    } 
    $filllength = round(($length * ($percentage/100))/2) * 2; 
    $fillcaplength = min(7, $filllength/2); 
    imagecopy($bar, $lfill, 0, 0, 0, 0, $fillcaplength, 14); 
    imagecopy($bar, $rfill, $filllength - $fillcaplength, 0, 7 - $fillcaplength, 0, $fillcaplength, 14); 
    if($filllength > 14) 
    { 
     imagecopyresized($bar, $fill, 7, 0, 0, 0, $filllength - 14, 14, 1, 14); 
    } 
    return $bar; 
} 
else 
{ 
    return false; 
} 
} 
+1

당신의 [이전 질문]의 차이점은 무엇입니까 (http://stackoverflow.com/questions/5224845/combining-images-in-php-while-retaining-transparency)? – Czechnology

+0

의도적으로 복사하여 붙여 넣기하는 중복 질문을하면 계정을 일시 중지하는 좋은 방법입니다. 제발 하지마. –

답변

0

...

imagealphablending($cropimg, false); 
imagesavealpha($cropimg, true); 

에서 찾을 수 있다면 나 또한했습니다 색상 할당을 설정하는 것이 도움이된다는 사실을 발견했습니다.

imageColorAllocate ($cropimg, 0, 0, 0); 

필자는 채워진 모든 이미지에서이 세 가지 기능을 호출해야한다고 생각합니다. 불완전한 대답에 대해 유감스럽게 생각하지만, 나는 서두르지 만 나는 너에게 뼈를 던질 것이라고 생각했다.

+0

죄송합니다. 작동하지 않았습니다. – Tyilo