Thumbnails und Bilder automatisch generieren

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

  • #16
    Lade doch einfach einfach alle Bilder in nen Array und benutze sort() um Die Bilder zu sortieren! Jetzt solltest du schon etwas weiter sein!

    Code um Tumbs zu generieren
    PHP Code:
    <?php
    header 
    ("Content-type: image/jpeg"); 


    $groesse getImageSize ($img); 

    $src_w $groesse[0]; 
    $src_h $groesse[1]; 
    $src_x 0
    $src_y 0
    $dst_w 200
    $dst_h = (int) $src_h $src_w $dst_w
    $dst_x 0
    $dst_y 0

    $src_im imageCreateFromJPEG ($img); 
    $dst_im ImageCreateTrueColor ($dst_w$dst_h); 

    ImageCopyResampled ($dst_im$src_im$dst_x$dst_y$src_x$src_y
    $dst_w$dst_h$src_w$src_h); 

    imageJPEG ($dst_im); 
    ?>
    GD Lib muss natürlich vorhanden sein!

    Comment


    • #17
      das mit dem array habe ich nun auch endlich...

      PHP Code:
      <?php
      $count 
      0;
      $path "./bilder"
      $handle opendir($path); 
      while (
      $file readdir ($handle)) 
        { 
        if (
      $file != "." && $file != "..")
          {
          
      $inhalt[count($inhalt)] = $file;
          }
        }
      closedir($handle);
      ?>
      aber wie gehts weiter... (das mit sort() bau ich auch ohne weitere probleme ein...) aber nun soll er für je 10 thumbnails eine tabelle erstellen mit überschrift... wie?

      Comment


      • #18
        geschafft!!!

        PHP Code:
        <?php
        session_start
        ();
        ?>
        <HTML>
        <HEAD>
        <TITLE>Bilder</TITLE>
        <link rel="stylesheet" href="css/style.css" type="text/css">
        </HEAD>
        <body bgcolor="#000066" text="#FFFFFF" leftmargin="0" topmargin="0"><br>
        <h1>Bilder</h1>
        <!-- (c)2002 by Christian Weinberger alias Harakiri -->
        <?php
        $count 
        0;
        $i 0;
        $k 0;
        $path "./bilder/bilder/"
        $handle opendir($path); 
        while (
        $file readdir ($handle)) 
          { 
          if (
        is_file($path.$file) && $file != "." && $file != "..")
            {
            
        $inhalt[count($inhalt)] = $file;
            
        $count++;
            }
          }
        closedir($handle);
        sort($inhaltsort_numeric);
        echo 
        "<table align=\"center\" width=\"500\" border=\"1\" bordercolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" style=\"table-layout:fixed\">
              <tr>
              <td colspan=\"10\" class=headertable>
              "
        $inhalt[$i][6],$inhalt[$i][7], "."$inhalt[$i][4],$inhalt[$i][5], "."$inhalt[$i][0],$inhalt[$i][1],$inhalt[$i][2],$inhalt[$i][3], "
              </td>
              </tr>
              <tr>"
        ;
        while (
        $i != $count)
          {
          
        $bilderpfad "./bilder/bilder";
          
        $thumbpfad "./bilder/bilder/thumbnails";
          
        $bildname $inhalt[$i];
          
        $bild "$bilderpfad/$bildname";
          
        $thumb "$thumbpfad/$bildname";
          if (!
        file_exists($thumb))
            {
            
        $src_img ImageCreateFromJPEG($bild);
            
        $width "50";
            
        $im_width imageSX($src_img);
            
        $im_height imageSY($src_img);
            
        $faktor $width/$im_width;
            
        $new_w $width;
            
        $new_h $im_height $faktor;
            
        $dst_img imagecreate($new_w,$new_h);
            
        imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
            
        imagejpeg($dst_img,$thumb);
            }
          echo 
        "<td><a href=\"#pop\" onclick=\"window.open(url='bild.php?url="$bild,"','blank','width=642, height=498, top=100, left=100')\"><img src=\""$thumb"\" border=\"0\"></a></td>";
          
        $k++;
          
        $i++;
          if (
        $i >= $count)
            {
            echo 
        "</tr>
            </table><br>"
        ;
            }
          else if (
        $k == "10")
            {
            echo 
        "</tr>
            </table><br>"
        ;
            echo 
        "<table align=\"center\" width=\"500\" border=\"1\" bordercolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" style=\"table-layout:fixed\">
                  <tr>
                  <td colspan=\"10\" class=headertable>
                  "
        $inhalt[$i][6],$inhalt[$i][7], "."$inhalt[$i][4],$inhalt[$i][5], "."$inhalt[$i][0],$inhalt[$i][1],$inhalt[$i][2],$inhalt[$i][3], "
                  </td>
                  </tr>
                  <tr>"
        ;
            
        $k 0;
            }
          }
        ?>
        </BODY>
        </HTML>
        Wenn noch was zum verbessern da ist - melden!

        Comment

        Working...
        X