PHP Classes

У меня ест&#1...

Recommend this page to a friend!

      Thumbnail Images  >  All threads  >  У меня...  >  (Un) Subscribe thread alerts  
Subject:У меня...
Summary:Package rating comment
Messages:2
Author:Taras
Date:2008-10-16 11:35:29
Update:2008-10-16 11:39:33
 

Taras rated this package as follows:

Utility: Good
Consistency: Good
Examples: Good

  1. У меня...   Reply   Report abuse  
Picture of Taras Taras - 2008-10-16 11:35:29
У меня есть одна поправка для класса - а именно корректаня работа с прозрачностью гиф и пнг.
Я исправил так
после if($NewImg_castr) {
ставлю
if ($this->mime == 'image/png'){
imagealphablending($NewImg_castr, false);
imagesavealpha($NewImg_castr, true);
}
а после
if($NewImg) {
такая вставка
if ($this->mime == 'image/png'){
imagealphablending($NewImg, false);
imagesavealpha($NewImg, true);
} else if($this->mime == 'image/gif') {
$trnprt_indx = imagecolortransparent($OldImg);
if($trnprt_indx > 0 && $trnprt_indx < imagecolorstotal($OldImg)) {
$trnprt_color = imagecolorsforindex($OldImg,$trnprt_indx);
$trnprt_indx = imagecolorallocate($NewImg,$trnprt_color['red'],$trnprt_color['green'],$trnprt_color['blue']);
imagepalettecopy($OldImg, $NewImg);
imagefill($NewImg, 0, 0, $trnprt_color);
imagecolortransparent($NewImg, $trnprt_color);
imagetruecolortopalette($NewImg, true, 256);

imagepalettecopy($OldImg, $NewImg_castr);
imagefill($NewImg_castr, 0, 0, $trnprt_color);
imagecolortransparent($NewImg_castr, $trnprt_color);
imagetruecolortopalette($NewImg_castr, true, 256);
}
}


  2. Re: &#1059; &#1084;&#1077;&#1085;&#1103;...   Reply   Report abuse  
Picture of Taras Taras - 2008-10-16 11:39:33 - In reply to message 1 from Taras
Sorry of my previous post.
I have for this class one better - correct work with Transparency


After
if($NewImg_castr) {
write
if ($this->mime == 'image/png'){
imagealphablending($NewImg_castr, false);
imagesavealpha($NewImg_castr, true);
}
and after
if($NewImg) {
write so:
if ($this->mime == 'image/png'){
imagealphablending($NewImg, false);
imagesavealpha($NewImg, true);
} else if($this->mime == 'image/gif') {
$trnprt_indx = imagecolortransparent($OldImg);
if($trnprt_indx > 0 && $trnprt_indx < imagecolorstotal($OldImg)) {
$trnprt_color = imagecolorsforindex($OldImg,$trnprt_indx);
$trnprt_indx = imagecolorallocate($NewImg,$trnprt_color['red'],$trnprt_color['green'],$trnprt_color['blue']);
imagepalettecopy($OldImg, $NewImg);
imagefill($NewImg, 0, 0, $trnprt_color);
imagecolortransparent($NewImg, $trnprt_color);
imagetruecolortopalette($NewImg, true, 256);
imagepalettecopy($OldImg, $NewImg_castr);
imagefill($NewImg_castr, 0, 0, $trnprt_color);
imagecolortransparent($NewImg_castr, $trnprt_color);
imagetruecolortopalette($NewImg_castr, true, 256);
}
}