PHP-Scripte PHP-Tutorials PHP-Jobs und vieles mehr

PHP-Scripte PHP-Tutorials PHP-Jobs und vieles mehr (https://www.php-resource.de/forum/)
-   PHP Developer Forum (https://www.php-resource.de/forum/php-developer-forum/)
-   -   imagecolortransparent - Problem (https://www.php-resource.de/forum/php-developer-forum/52456-imagecolortransparent-problem.html)

Raiser 29-03-2005 00:41

imagecolortransparent - Problem
 
(teil 1)
hiho, sorry ist leider sehr umfangreich, aber auch nich
zu durchzublicken
hab leider das problem, das ich nach dem aufrufen von
thumbnail() zwar ein gif habe, daß aber leider nicht transparent ist

PHP-Code:

<?php
if(!function_exists('gif_info'))
{
    function 
gif_info($filename)
    {
             
$fp=                     fopen($filename,'rb');
             
$result=                 fread($fp,13);
             
$file['signatur']=       substr($result,0,3);
             
$file['version']=        substr($result,3,3);
             
$file['width']=          ord(substr($result,6,1))+ord(substr($result,7,1))*256;
             
$file['height']=         ord(substr($result,8,1))+ord(substr($rsult,9,1))*256;
             
$file['flag']=           ord(substr($result,10,1))>>7;
             
$file['trans_red']=      ord(substr($result,ord(substr($result,11))*3,1));
             
$file['trans_green']=    ord(substr($result,ord(substr($result,11))*3+1,1));
             
$file['trans_blue']=     ord(substr($result,ord(substr($result,11))*3+2,1)) ;
             
fclose($fp);
             return 
$file;
    }
}

?>


Raiser 29-03-2005 00:51

PHP-Code:

<?php
$thumb
=imagecreatetruecolor($new_width,$new_height);
           switch(
$type):
                  case 
1:   $im=imagecreatefromgif($image);
                            
$info=gif_info($image);
                            
//echo $info['version'];
                            /* */
                            
if($info['version']=='89a' && $info['flag']==1)
                            {
                               
imagefilledrectangle($thumb,0,0,$new_width,$new_height,
(
imagecolorat($im,0,0)));
                               
//imagecolorallocate($im,$info['trans_red'],$info['trans_green'],$info['trans_blue'])
                               //hatte ich auch schon verwendet, da wird nur mit schwarz gefüllt
                            
}
                            break;
                  case 
2:   $im=imagecreatefromjpeg($image);
                            break;
                  case 
3:   $im=imagecreatefrompng($image);
                            break;
           endswitch;
           
imagecopyresized($thumb,$im,0,0,0,0,$new_width,$new_height,$width,$height);
           switch(
$type):
                  case 
1:   $info=gif_info($image);
                            if(
$info['version']=='89a' && $info['flag']==1)
                            {
                               
imagecolortransparent($thumb,
(
imagecolorallocate($im,$info['trans_red'],$info['trans_green'],$info['trans_blue'])));
                            }
                            
imagegif($thumb,$dest.'/thumb_'.$name);
                            break;
                  case 
2:   imagejpeg($thumb,$dest.'/thumb_'.$name);
                            break;
                  case 
3:   imagepng($thumb,$dest.'/thumb_'.$name);
                            break;
           endswitch;
        }
//--ende seitenrechnung
    
}//--ende funktion
}
?>



Alle Zeitangaben in WEZ +2. Es ist jetzt 03:39 Uhr.

Powered by vBulletin® Version 3.8.2 (Deutsch)
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
[c] ebiz-consult GmbH & Co. KG