imagecolortransparent - Problem

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • 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;
        }
    }

    ?>

  • #2
    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
    }
    ?>

    Kommentar

    Lädt...
    X