Thumbnails

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Thumbnails

    Ich erzeug über folgende Funktion Thumbnails für ne Screenshotgallerie. Wodran liegt es das die Bilder teilweise ihre Farbe verlieren und wie kann ich das beheben.

    PHP Code:
    function Thumb ($GIMG)
    {
      global 
    $IMAGE_WIDTH;
      global 
    $IMAGE_HEIGHT;
      
    $info getimagesize($GIMG,$info2);


      if ((
    $info[0]>$IMAGE_WIDTH) ||  ($info[1]>$IMAGE_HEIGHT))
      {
      if (
    file_exists("images/tmb/tmb_".basename($GIMG)))
      {
        
    $IMG="images/tmb/tmb_".basename($GIMG);
      }
      else
      {
        if (
    $info[0]>$info[1])
        {
          
    $tmbscale=($info[0]/$IMAGE_WIDTH);
          
    $tmbwidth=$IMAGE_WIDTH;
          
    $tmbheight=($info[1]/$tmbscale);
          

        }
        else
        {
          
    $tmbscale=($info[1]/$IMAGE_HEIGHT);
          
    $tmbheight=$IMAGE_HEIGHT;
          
    $tmbwidth=($info[0]/$tmbscale);
        }


        
        switch (
    $info[2])
        {
          case 
    2:

            
    $image imagecreatefromjpeg($GIMG);
            
    $image1 imagecreate($tmbwidth,$tmbheight);
            
    $farbe_body=imagecolorallocate($image1,255,255,255);
            
    imagecopyresized($image1$image0,00,0,$tmbwidth,$tmbheight$info[0],$info[1]);

            
    imagejpeg($image1,"images/tmb/tmb_".basename($GIMG));
            
    $IMG="images/tmb/tmb_".basename($GIMG);
            break;


          case 
    3:
            
    $image imagecreatefrompng($GIMG);
            
    $image1 imagecreate($tmbwidth,$tmbheight);
            
    $farbe_body=imagecolorallocate($image1,255,255,255);
            
    imagecopyresized($image1$image0,00,0,$tmbwidth,$tmbheight$info[0],$info[1]);

            
    imagepng($image1,"images/tmb/tmb_".basename($GIMG));
            
    $IMG="images/tmb/tmb_".basename($GIMG);
            break;

          case 
    1:
            
    $image imagecreatefromgif($GIMG);
            
    $image1 imagecreate($tmbwidth,$tmbheight);
            
    $farbe_body=imagecolorallocate($image1,255,255,255);
            
    imagecopyresized($image1$image0,00,0,$tmbwidth,$tmbheight$info[0],$info[1]);

            
    imagegif($image1,"images/tmb/tmb_".basename($GIMG));
            
    $IMG="images/tmb/tmb_".basename($GIMG);
            break;

        }
      }
      }
      else
      {
      
    $IMG=$GIMG;

    }
      echo 
    ' <a href=javascript:popupw=window.open("'.$GIMG.'","Screenshot",
    "dependent=no,height='
    .($info[1]+20).',hotkeys=no,left=0,location=no,menubar=no,
    resizable=yes,scrollbars=no,status=no,toolbar=no,top=0,width='
    .($info[0]+20).'");popupw.focus();><img src='.$IMG.' border=0></a> ';


    Online zu bewundern unter:
    http://www.xtremenintendo.de/index.p...hot/screenshot

    MfG
    mnhg
    Team BashComp

  • #2
    Probiers mal mit
    PHP Code:
    $image1 ImageCreateTrueColor($tmbwidth,$tmbheight);
    // anstatt
    $image1 ImageCreate($tmbwidth,$tmbheight); 
    http://at.php.net/manual/de/function...etruecolor.php

    Comment


    • #3
      Danke für die schnelle Hilfe.
      Hat natürlich funktioniert.

      MfG
      mnhg
      www.bashcomp.de
      Team BashComp

      Comment

      Working...
      X