Wie Namen ausblenden?

siros

Mitglied
Hallo alle zusammen!

Ich würde gerne die Bilder galleri in meine Seite einbauen.
Mich stört aber das unter den thumbnail immer der Name des Bildes ausgegeben wird.
Kann mir vielleicht einer von euch sagen wo ich das in dem Code auskommentieren kann?


Code:
<?php
/*//////////////////////////////////////////////////////////////////////////////
// Copyright          N. Waldisphl, 2003-05
////////////////////////////////////////////////////////////////////////////////
// Project            RetortePictureBrowser / Script for displaying images
//
//                    Read readme.txt for further infos
//
// Dateiname          index.php
//
// Author             Nico Waldisphl NW
// Contact            nw at retorte dot ch
// Datum of creat.    27. July 2003
//
//This program is free software; you can redistribute it and/or modify it under
//the terms of the GNU General Public License as published by the Free Software
//Foundation; either version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful, but WITHOUT
//ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
//FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License along with
//this program; if not, write to the Free Software Foundation, Inc., 59 Temple
//Place, Suite 330, Boston, MA 02111-1307, USA. (http://www.fsf.org/)
//////////////////////////////////////////////////////////////////////////////*/

////////////////////////////////////////////////////////////////////////////////
// Classdefinition and such
////////////////////////////////////////////////////////////////////////////////
class PICTURE_BROWSER
{
    var $version;
    var $aktId;
    var $navArray;
    var $pictures;
    var $title;
    var $cols;
    var $thumb_width;
    var $tn_mode;
    var $sort;
    var $thumbs_per_page;
    var $description;
    var $description_old;
    var $link_vor;
    var $link_zurueck;
    var $link_up;
    var $page_vor;
    var $page_zurueck;
    var $comments;
    var $comments_old;
    var $prev_width;
    var $template_thumb;
    var $template_pic;
    var $show_nav;
    var $header;

/*--------------------------------------------------------------------*/
/* Constructor                                                        */
/*--------------------------------------------------------------------*/
    function Picture_Browser()
    {
        // Nice thingies to start

        // Configuration
        $this->doConfig();

        // Check, if comment files available
        $this->checkCommentFile();

        // Return special HTTP Header to browser.
        $this->putHTTPHeader();

    }
    
/*--------------------------------------------------------------------*/
/* Configuration; read configfile                                     */
/*--------------------------------------------------------------------*/
    function doConfig()
    {
        $config_file = "pb.conf";

        // Read configfiles.
        if(file_exists($config_file))
        {
                $cf = @file($config_file);

                while($config_abfrage = each($cf))
                {
                        $config_abfrage = trim($config_abfrage[1]);
                        if( (strpos($config_abfrage, "#")==false) AND (!empty($config_abfrage)) )
                        {
                                $einzelteile = explode("=", $config_abfrage);
                                $varname = stripslashes(trim($einzelteile[0]));
                                $varvalue = stripslashes(trim($einzelteile[1]));
                                $$varname = $varvalue;
                        }
                }
        }




// Global preferences, fallback. Don't do anything here. Use pb.conf!
////////////////////////////////////////////////////////////////////////

        $version = "2.4.1";

        // Title
        if(!isset($title)) {
                $title = "Retorte Picture Browser V $version";
        }

        // Number of thumbnails per line
        if(!isset($cols)) {
                $cols = 8;
        }

        // Size (in pixels) of thumbnails (always square)
        if(!isset($width)) {
                $width = 80;
        }

        // Thumbnailmode
        //  1: Don't scale, cut out little square
        //  2: Scale proportional, cut only the rest
        if(!isset($mode)) {
                $mode = 2;
        }
        else
        {
                if($mode=="cut")
                {
                        $mode = 1;
                }
                else
                {
                        $mode = 2;
                }
        }
        
        // Sortmode
        if(!isset($sort)) {
                $sort = "name";
        }
        
        // Number of thumbnails displayed per page
        if(!isset($thumbs_per_page)) {
                $thumbs_per_page = 0;
        }

        // Name of file with description
        if(!isset($description)) {
                $description = "pb_desc.txt";
        }

        // Name of (existing) file with description 
                if(!isset($description_old)) {
                $description_old = "pb_desc.old";
        }

        // Text for various links

        // next picture
        if(!isset($forward)) {
                $forward = "forward (next picture) &raquo;";
        }

        // previous picture
        if(!isset($back)) {
                $back = "&laquo; back (previous picture)";
        }
        
        // next page
        if(!isset($next)) {
                $next = "forward (next page) &raquo;";
        }

        // previous page
        if(!isset($previous)) {
                $previous = "&laquo; back (previous page)";
        }

        // back up
        if(!isset($up)) {
                $up = "up (back to thumbnails)";
        }

        // Name of file with comments
        if(!isset($comments)) {
                $comments = "comments.txt";
        }

        // Name of (existing) file with comments
        if(!isset($comments_old)) {
                $comments_old = "comments.old";
        }

        // Size of thumbnails in comment generator
       if(!isset($prev_width)) {
                $prev_width = 180;
        }

       // Template for thumbnail view
       if(!isset($template_thumb)) {
                $template_thumb = "template_thumb.inc.html";
        }

       // Template for image view
       if(!isset($template_pic)) {
                $template_pic = "template_pic.inc.html";
        }

        // Show navigation if not useful?
       if(!isset($show_nav)) {
                $show_nav = 1;
        }

        // HTML file header
        $header = "<!--

            Retorte Picture Browser V $version
            http://www.retorte.ch/tools/picturebrowser
            ------------------------------------------------------
            Funktion: Zeigt Bilder eines Verzeichnisses in einer
            Gesamtvorschau und auch einzeln zum Navigieren an.
            Erstellt dynamisch Thumbnails. Problemlos einzusetzen.
            ------------------------------------------------------
            (c) 2003/04 Nico Waldispuehl (http://www.retorte.ch)

            //-->
            ";

        // Define variables with values from above
        $this->version = $version;
        $this->title = $title;
        $this->thumb_cols = $cols;
        $this->thumb_width = $width;
        $this->tn_mode = $mode;
        $this->sort = $sort;
        $this->thumbs_per_page = $thumbs_per_page;
        $this->description = $description;
        $this->description_old = $description_old;
        $this->link_vor = $forward;
        $this->link_zurueck = $back;
        $this->link_up = $up;
        $this->page_vor = $next;
        $this->page_zurueck = $previous;
        $this->comments = $comments;
        $this->comments_old = $comments_old;
        $this->prev_width = $prev_width;
        $this->template_thumb = $template_thumb;
        $this->template_pic = $template_pic;
        $this->show_nav = $show_nav;
        $this->header = $header;

        // PB reads these image formats
        $this->supported_pf = array("gif",
                                    "jpg",
                                    "jpeg",
                                    "png");


        $this->check_integrity();
        $this->readDirectory();

    }
    
/*--------------------------------------------------------------------*/
/* Definition of errorcodes                                          */
/*--------------------------------------------------------------------*/
    function set_error_codes()
    {
      define("ERROR_TEMPLATE_MISSING", "Achtung: Ein HTML Template konnte nicht gefunden werden!");
      define("ERROR_IMAGE_FILE_MISSING", "Achtung: Die Datei pb_img.php konnte nicht gefunden werden!");
    }

/*--------------------------------------------------------------------*/
/* Check if all important data is available                           */
/*--------------------------------------------------------------------*/
    function check_integrity()
    {
        $this->set_error_codes();

        if(!file_exists($this->template_pic))
        {
          $this->show_error_message(ERROR_TEMPLATE_MISSING);
        }
        if(!file_exists($this->template_thumb))
        {
          $this->show_error_message(ERROR_TEMPLATE_MISSING);
        }
        if(!file_exists("./pb_img.php"))
        {
          $this->show_error_message(ERROR_IMAGE_FILE_MISSING);
        }
    }

/*--------------------------------------------------------------------*/
/* Reads current directory                                            */
/*--------------------------------------------------------------------*/
    function readDirectory()
    {

        // Read all elemets of current dir into array
        $verzeichnis = "./";
        $v = dir($verzeichnis);
        $v->rewind();
        while($dir_output = $v->read())
        {
                $dir_output_arr[] = $dir_output;
        }

        // Sort elements
        natsort($dir_output_arr);

        // Sort out useless things
        while($dir_out_pre = each($dir_output_arr))
        {
          $dir_out = $dir_out_pre[1];

          // Put away dirs
          if(!@is_dir($dir_out))
          {
            $dir_out_arr = explode(".", $dir_out);
            $dir_out_arr_rev = array_reverse($dir_out_arr);
            $endung = strtolower($dir_out_arr_rev[0]);

            $write_trig = 0;
            // Put away not supported files
            while($endung_ctrl = each($this->supported_pf))
            {
              if(strtolower($endung_ctrl[1])==$endung)
              {
              $write_trig = 1;
              }
            }
            reset($this->supported_pf);

            $file_cont = "$dir_out";
            if($write_trig == 1)
            {
                    $this->pictures[] = $file_cont;
            }
          }
        }
        
        // if images shall be sorted by data, rearrange array
        if($this->sort == "date" AND @function_exists(read_exif_data) AND !empty($this->pictures))
        {
          // we need a second and a third array
          $exif_images_array = array();
          $non_exif_images_array = array();
          
          while($eintrag = each($this->pictures))
          {
            $zeile = $eintrag[1];
            $zeilen_arr = explode(";;;", $zeile);
            $dateiname = $zeilen_arr[0];
            $dateigroesse = round((filesize("./$dateiname")/1024),1)." KB";

            $dateiname_arr = array_reverse(explode(".", $dateiname));
            if((strtolower($dateiname_arr[0])=="jpg")OR(strtolower($dateiname_arr[0])=="jpeg"))
            {
              $exif_daten = @read_exif_data("./$dateiname");

              if(isset($exif_daten["DateTimeOriginal"]))
              {
                $datum_zeit = explode(" ", $exif_daten["DateTimeOriginal"]);
                $datum_roh = $datum_zeit[0];
                $jahr = substr($datum_roh, 0, 4);
                $monat = substr($datum_roh, 5, 2);
                $tag = substr($datum_roh, 8, 2);
                $datum = $jahr . $monat . $tag;

                $stunden = substr($datum_zeit[1], 0, 2);
                $minuten = substr($datum_zeit[1], 3, 2);
                $sekunden = substr($datum_zeit[1], 6, 2);
                
                $zeit = $stunden . $minuten . $sekunden;

                $stamp = $datum . $zeit;
                
                $exif_images_array[$stamp] = $eintrag[1];
              }
              else
              {
                $non_exif_images_array[] = $eintrag[1];
              }
            }
            else
            {
              // ... if no jpeg...
              $non_exif_images_array[] = $eintrag[1];
            }                 
          }
          
          // Sort array with EXIF enables files by key (=timestamp)   
          ksort($exif_images_array);
          
          // Sort array with non EXIF files by name
          natsort($non_exif_images_array);
          
          // Merge arrays
          $this->pictures = array();
          
          reset($exif_images_array);
          reset($non_exif_images_array);
          
          while($out = each($exif_images_array))
          {
            $this->pictures[] = $out[1];
          }
          
          while($out = each($non_exif_images_array))
          {
            $this->pictures[] = $out[1];
          }
        }
    }


/*--------------------------------------------------------------------*/
/* Generate context sensitive forward link                            */
/*--------------------------------------------------------------------*/
    function forward()
    {
        if(isset($_GET["pic"]))
        {
                $aktId = abs($_GET["pic"]);
                $navArray = $this->pictures;
                $nextId = $aktId + 1;

                if(isset($navArray[$nextId]))
                {
                        $output = "<a href='./?pic=$nextId' class='navlink'>".$this->link_vor."</a>";
                }
            else
            {
                $output = "<span class='navlink_inactive'>".$this->link_vor."</span>";
            }
        }
        else
        {
          $totalpics = count($this->pictures);
          if($totalpics > $thumbs_per_page AND $this->thumbs_per_page > 0)
          {
            $total_pages = ceil($totalpics / $this->thumbs_per_page);
          
            if(isset($_GET["page"]))
            {
              $actual_page = abs($_GET["page"]);
              if($actual_page < 1)
              {
                $actual_page = 1;
              }
            }
            else
            {
              $actual_page = 1;
            } 
            
            $next_page = $actual_page + 1;
            
            if($actual_page < $total_pages)
            {
              $output = "<a href='./?page=$next_page' class='navlink'>".$this->page_vor."</a>";
            }
            else
            {
              $output = "<span class='navlink_inactive'>".$this->page_vor."</span>";
            }           
          }
          else
          {
            if($this->show_nav==1)
            {
              $output = "<span class='navlink_inactive'>".$this->page_vor."</span>";
            }
            else
            {
              $output = "";
            }
          }
        }
        return $output;
    }

/*--------------------------------------------------------------------*/
/* Generate context sensitive backward link                           */
/*--------------------------------------------------------------------*/
    function back()
    {
        if(isset($_GET["pic"]))
        {
                $aktId = abs($_GET["pic"]);
                $navArray = $this->pictures;
                $prevId = $aktId - 1;

                if(isset($navArray[$prevId]))
                {
                        $output = "<a href='./?pic=$prevId' class='navlink'>".$this->link_zurueck."</a>";
                }
            else
            {
               $output = "<span class='navlink_inactive'>".$this->link_zurueck."</span>";
            }
        }
        else
        { 
          $totalpics = count($this->pictures);
          if($totalpics > $thumbs_per_page AND $this->thumbs_per_page > 0)
          {
            $total_pages = ceil($totalpics / $this->thumbs_per_page);
          
            if(isset($_GET["page"]))
            {
              $actual_page = abs($_GET["page"]);
              if($actual_page > ceil($totalpics / $this->thumbs_per_page))
              {
                $actual_page = ceil($totalpics / $this->thumbs_per_page);
              }
            }
            else
            {
              $actual_page = 1;
            } 
            
            $previous_page = $actual_page - 1;
            
            if($actual_page > 1)
            {
              $output = "<a href='./?page=$previous_page' class='navlink'>".$this->page_zurueck."</a>";
            }
            else
            {
              $output = "<span class='navlink_inactive'>".$this->page_zurueck."</span>";
            }           
          }
          else
          {
            if($this->show_nav==1)
            {
              $output = "<span class='navlink_inactive'>".$this->page_zurueck."</span>";
            }
            else
            {
              $output = "";
            }
          }
        }
        return $output;
    }


/*--------------------------------------------------------------------*/
/* Generate context sensitive up link                                 */
/*--------------------------------------------------------------------*/
    function up()
    {
        if(isset($_GET["pic"]))
        {
            $totalpics = count($this->pictures);
            if($totalpics > $this->thumbs_per_page AND $this->thumbs_per_page > 0)
            {
              $current_pic = $_GET["pic"];
              
              $current_page = ceil(($current_pic + 1) / $this->thumbs_per_page);
              $output = "<a href='./?page=$current_page' class='navlink'>".$this->link_up."</a>";
            }
            else
            {
              $output = "<a href='./' class='navlink'>".$this->link_up."</a>";
            }
        }
        else
        {
          if($this->show_nav==1)
          {
                $output = "<span class='navlink_inactive'>".$this->link_up."</span>";
          }
          else
          {
            $output = "";
          }
        }
        return $output;
    }
    
/*--------------------------------------------------------------------*/
/* Generate pages link series                                         */
/*--------------------------------------------------------------------*/
    function pages()
    {
      if(!isset($_GET["pic"]) AND $this->thumbs_per_page > 0)
      {
        $totalpics = count($this->pictures);
        if($totalpics > $this->thumbs_per_page)
        {
          if(isset($_GET["page"]))
          {
            $actual_page = abs($_GET["page"]);
            if($actual_page > ceil($totalpics / $this->thumbs_per_page))
            {
              $actual_page = ceil($totalpics / $this->thumbs_per_page);
            }
            elseif($actual_page == 0)
            {
              $actual_page = 1;
            }
          }
          else
          {
            $actual_page = 1;
          }
          
          for($current_page = 1; $current_page <= ceil($totalpics / $this->thumbs_per_page) ;$current_page++)
          {
            if($current_page == $actual_page)
            {
              $output .= "<b>$current_page</b> ";
            }
            else
            {
              $output .= "<a href='?page=$current_page'>$current_page</a> ";
            }
          }
          
        }
      }
      else
      {
        $output = "";
      }
      
      return $output;
    }


/*--------------------------------------------------------------------*/
/* Generate EXIF Information                                          */
/*--------------------------------------------------------------------*/
    function showExif()
    {
        if(isset($_GET["pic"]))
        {
            $pic = abs($_GET["pic"]);

            $totalpics = count($this->pictures);




            $hoechster_index = (count($this->pictures)-1);
            if($pic > $hoechster_index)
            {
                /* $output = "<span class='exif_inactive'>Filename:
                none | Filesize: none | Date:
                none | Time: none | Camera:
                none</span>"; */
            }
            else
            {
                $zeile = $this->pictures[$pic];
                $zeilen_arr = explode(";;;", $zeile);
                $dateiname = $zeilen_arr[0];
                $dateigroesse = round((filesize("./$dateiname")/1024),1)." KB";

                $dateiname_arr = array_reverse(explode(".", $dateiname));
                if((strtolower($dateiname_arr[0])=="jpg")OR(strtolower($dateiname_arr[0])=="jpeg"))
                {
                    if(@function_exists(read_exif_data))
                    {
                        $exif_daten = @read_exif_data("./$dateiname");

                        if(isset($exif_daten["DateTimeOriginal"]))
                        {
                            $datum_zeit = explode(" ", $exif_daten["DateTimeOriginal"]);
                            $datum_roh = $datum_zeit[0];
                            $jahr = substr($datum_roh, 0, 4);
                            $monat = substr($datum_roh, 5, 2);
                            $tag = substr($datum_roh, 8, 2);
                            $datum = "$tag.$monat.$jahr";

                            $zeit = substr($datum_zeit[1], 0, 5);

                            $kamera = $exif_daten["Model"]. " (".$exif_daten["Make"].")";
                            $blende = $exif_daten["FNumber"];
                            $belichtungszeit = $exif_daten["ExposureTime"]." seconds";

                            $blitz_roh = $exif_daten["Flash"];
                            $blitz = "No";
                            if($blitz_roh%2==1)
                            {
                              $blitz = "Yes";
                            }

                            $no_exif_flag = 0;

                        }
                        else
                        {
                            $no_exif_flag = 1;

                            $datum = "-";
                            $kamera = "-";
                            $blende = "-";
                            $belichtungszeit = "-";
                            $zeit = "-";
                        }
                    }
                    elseif(@function_exists(exif_read_data))
                    {
                        // If 'wrong' routine is supported, do nothing
                        $datum = "-";
                        $kamera = "-";
                        $blende = "-";
                        $belichtungszeit = "-";
                        $zeit = "-";
                        $blitz = "-";
                    }
                    else
                    {
                        // If no EXIF routine is supported...
                        $datum = "-";
                        $kamera = "-";
                        $blende = "-";
                        $belichtungszeit = "-";
                        $zeit = "-";
                        $blitz = "-";
                    }

                    if($no_exif_flag == 1)
                    {
                      /* $output = "<span class='exif'><span class='exif_titel'>Filename:</span>
                      $dateiname | <span class='exif_titel'>Filesize:</span> $dateigroesse</span>"; */
                    }
                    else
                    {
                      $output = "<span class='exif'><span class='exif_titel'>Filename:</span>
                      $dateiname | <span class='exif_titel'>Filesize:</span> $dateigroesse | <span class='exif_titel'>Date:</span>
                      $datum | <span class='exif_titel'>Time:</span> $zeit | <span class='exif_titel'>Camera:</span>
                      $kamera | <span class='exif_titel'>Aperture:</span> $blende | <span class='exif_titel'>Exposure:</span> $belichtungszeit | <span class='exif_titel'>Flash:</span> $blitz</span>";
                    }
                }
                else
                {
                        $output = "<span class='exif'><span class='exif_titel'>Filename:</span>
                    $dateiname | <span class='exif_titel'>Filesize:</span> $dateigroesse</span>";
                }
            }
        }
        else
        {
          if($this->show_nav==1)
          {
		  /* Bilder beschreibung */
              /*   $output = "<span class='exif_inactive'>Filename:
            none | Filesize: none | Date:
            none | Time: none | Camera:
            none</span>"; */
          }
          else
          {
            $output = "";
          }
        }
        return $output;
    }
 
Teil zwei vom Code!

Code:
/*--------------------------------------------------------------------*/
/* Generate table of pictures                                         */
/*--------------------------------------------------------------------*/
    function showPics()
    {


        if(isset($_GET["pic"]))
        {
            $pic = abs($_GET["pic"]);
            $hoechster_index = (count($this->pictures)-1);
            $anzahl_bilder = count($this->pictures);
            if($pic > $hoechster_index)
            {
                $output = "<span class='text'>&nbsp;</br>Kein Bild mit diesem Index gefunden!</span>";
            }
            else
            {
                $zeile = $this->pictures[$pic];
                $zeilen_arr = explode(";;;", $zeile);
                $bildurl = $zeilen_arr[0];
                if(empty($zeilen_arr[1])OR(strlen($zeilen_arr[1])<3))
                {
                    $text = $bildurl;
                }
                else
                {
                    $text = $zeilen_arr[1];
                }
                $akt_bild = $pic+1;
                
                $imagedata = getimagesize("./$bildurl");
                
                $output = "<img src='./$bildurl' class='image_border' width='". $imagedata[0] ."' height='". $imagedata[1] ."'>";
            }
        }
        else
        {
            $cellpadding = 3;

            $output .= "<table border='0' cellspacing='0' cellpadding='$cellpadding' class='kleintext'>\n";
            
            $totalpics = count($this->pictures);
            
            if(isset($_GET["page"]))
            {
              $current_page = abs($_GET["page"]);
              if($current_page > ceil($totalpics / $this->thumbs_per_page))
              {
                $current_page = ceil($totalpics / $this->thumbs_per_page);
              }
              elseif($current_page == 0)
              {
                $current_page = 1;
              }
            }
            else
            {
              $current_page = 1;
            }       
            
            if($this->thumbs_per_page > 0 AND $totalpics > $this->thumbs_per_page)
            {
              $bilderanzahl = $this->thumbs_per_page;
            }
            else
            {
              $bilderanzahl = count($this->pictures);
            }

            $tiefster_index = ($current_page - 1) * $this->thumbs_per_page;
            
            if($current_page == ceil($totalpics / $this->thumbs_per_page))
            {
              $hoechster_index = ($totalpics-1);
            }
            else
            {
              $hoechster_index = $tiefster_index + $this->thumbs_per_page - 1;
            }
 
            $zeilenanzahl = ceil($bilderanzahl / $this->thumb_cols);
            for($z=0; $z<$zeilenanzahl; $z++)
            {
                $output .= "<tr>\n";

                for($s=0; $s<$this->thumb_cols; $s++)
                {
                    $bild_id = $tiefster_index + ($z * $this->thumb_cols) + $s;
                    $output .= "<td align='center'>";
                    if($bild_id <= $hoechster_index)
                    {
                        $dateizeile = $this->pictures[$bild_id];
                        $dateizeilen_arr = explode(";;;", $dateizeile);
                        $bildurl = $dateizeilen_arr[0];
                        $bildurl_ganz = $dateizeilen_arr[0];
                        $bildurl_einzeln = explode(".", $bildurl);
                        if(strlen($bildurl_einzeln[0])>12)
                        {
                            $bildurl = substr($bildurl_einzeln[0], 0, 10).".. .".$bildurl_einzeln[1];
                        }
                        if($this->tn_mode==1)
                        {
                            $tnmodewahl = "&tnm=1";
                        }
                        else
                        {
                            $tnmodewahl = "&tnm=2";
                        }
                        $output .= "<a href='./?pic=$bild_id'>
                        <img src='pb_img.php?pic_name=$bildurl_ganz&tb=".$this->thumb_width.$tnmodewahl."' height='".$this->thumb_width."' width='".$this->thumb_width."' border='0' class='image_border_thumbnail'><br/>$bildurl</a>";
                    }
                    else
                    {
                        $output .= "&nbsp;";
                    }
                    $output .= "</td>";
                }
                
                $output .= "</tr>";
            }
            $output .= "</table>";
    
        }
        return $output;
    }

/*--------------------------------------------------------------------*/
/* Process templates                                                  */
/*--------------------------------------------------------------------*/
    function processTemplates()
    {
      // Read templates
      if(isset($_GET["pic"]))
      {
        $th = fopen($this->template_pic, "r");
      }
      else
      {
        $th = fopen($this->template_thumb, "r");
      }

        // Insert comment
        $templateString = $this->showHeader();

        $templateString .= fread($th, 512000);

        // Replace pattern
        $actionMuster = "<!--#title-->";
        $actionErsatz = $this->showTitle();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#exif-->";
        $actionErsatz = $this->showExif();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#back-->";
        $actionErsatz = $this->back();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#forward-->";
        $actionErsatz = $this->forward();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#up-->";
        $actionErsatz = $this->up();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);
        
        $actionMuster = "<!--#pages-->";
        $actionErsatz = $this->pages();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#comment-->";
        $actionErsatz = $this->showComment();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#description-->";
        $actionErsatz = $this->showDescription();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#pics-->";
        $actionErsatz = $this->showPics();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#thumbtitle-->";
        $actionErsatz = $this->showThumbTitle();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        $actionMuster = "<!--#pictitle-->";
        $actionErsatz = $this->showPicTitle();
        $templateString = eregi_replace("$actionMuster", $actionErsatz, $templateString);

        // Output data
        echo $templateString;


    }

/*--------------------------------------------------------------------*/
/* Show page description                                              */
/*--------------------------------------------------------------------*/
    function showDescription()
    {
        $output = "";
        if(!isset($_GET["pic"]))
        {
                if(file_exists($this->description))
                {
                        $text_array = file($this->description);
                        $text = implode("", $text_array);
                        if(!empty($text))
                        {
                          $text = stripslashes($text);
                          $text = htmlentities($text);
                          $text = nl2br($text);
                          $desc_breite = ($this->thumb_cols * $this->thumb_width) + (($this->thumb_cols-1)*6);
                          $output = "<table width='$desc_breite'><tr><td align='center'><span class='text'>".$text."</span></td></tr></table>";
                        }
                }
        }
        return $output;
    }

/*--------------------------------------------------------------------*/
/* Show image comments                                                */
/*--------------------------------------------------------------------*/
    function showComment()
    {
        $comment_out = "";
        if(isset($_GET["pic"]))
        {
                if(file_exists($this->comments))
                {
                        $commentfile = file($this->comments);
                        $act_filename = $this->pictures[$_GET["pic"]];
                        $output = "";

                        while($commentfilezeile = each($commentfile))
                        {
                                $zeilenarray =  explode("=", trim($commentfilezeile[1]));
                                $dateiname = trim($zeilenarray[0]);
                                $kommentar = trim($zeilenarray[1]);

                                if(strtolower($act_filename) == strtolower($dateiname))
                                {
                                        $output = htmlentities($kommentar, ENT_QUOTES);
                                }
                        }

                        if(!empty($output))
                        {
                                $output = stripslashes($output);
                                $comment_out = $output;
                        }
                }
        }
        return $comment_out;
    }

/*--------------------------------------------------------------------*/
/* Show page title                                                    */
/*--------------------------------------------------------------------*/
    function showTitle()
    {
        return ($this->title);
    }

/*--------------------------------------------------------------------*/
/* Show thumbnail title  / Wo liegen die Bilder/                                             */
/*--------------------------------------------------------------------*/
    function showThumbTitle()
    {
       if(!isset($_GET["pic"]))
       {
              if(!empty($_SERVER["REQUEST_URI"]))
            {
                $galerietitel_roh = array_reverse(explode("/", $_SERVER["REQUEST_URI"]));
                $galerietitel = $galerietitel_roh[1]."/";
            }
            else
            {
                $galerietitel = "";
            }
            $total_bilder = count($this->pictures);
            $anzahl_text = "";
            if($total_bilder>5)
            {
                $anzahl_text = "($total_bilder Bilder)";
            }
/*             $output = "<span class='titel'>$galerietitel $anzahl_text</span>";
 */      }
      return $output;
    }

/*--------------------------------------------------------------------*/
/* Show picture title    /Beschreibung grosse Bilder/                                             */
/*--------------------------------------------------------------------*/
    function showPicTitle()
    {
      //Zeigt den Dateinamen und die aktuelle Position an
        if(isset($_GET["pic"]))
        {
            $pic = abs($_GET["pic"]);
            $hoechster_index = (count($this->pictures)-1);
            $anzahl_bilder = count($this->pictures);
            if($pic <= $hoechster_index)
            {
                $zeile = $this->pictures[$pic];
                $zeilen_arr = explode(";;;", $zeile);
                $bildurl = $zeilen_arr[0];
                if(empty($zeilen_arr[1])OR(strlen($zeilen_arr[1])<3))
                {
                    $text = $bildurl;
                }
                else
                {
                    $text = $zeilen_arr[1];
                }
                $akt_bild = $pic+1;
/*                 $output = "<span class='titel'>$text ($akt_bild/$anzahl_bilder)</span>";
 */            }
        }
        return $output;
    }

/*--------------------------------------------------------------------*/
/* Check comment file                                                 */
/*--------------------------------------------------------------------*/
    function checkCommentFile()
    {
      if(isset($_POST["submit"]))
      {


        if(isset($_POST["beschreibung"]))
        {
          if(file_exists($this->description))
          {
            unlink($this->description);
          }
          if(file_exists($this->description_old))
          {
            unlink($this->description_old);
          }

          $df = fopen($this->description, "w");

          $beschreibung = $_POST["beschreibung"];
          if(@function_exists("html_entity_decode")==TRUE)
          {
            $beschreibung = html_entity_decode($beschreibung, ENT_QUOTES);
          }
          $beschreibung = addslashes($beschreibung);
          fputs($df, "$beschreibung");

          fclose($df);


        }


        if(isset($_POST[0]))
        {
          unlink($this->comments);
          if(file_exists($this->comments_old))
          {
            unlink($this->comments_old);
          }
          $cf = fopen($this->comments, "w");

          while($input = each($this->pictures))
          {
            $kommentar = $_POST[$input[0]];
            if(@function_exists("html_entity_decode")==TRUE)
            {
              $kommentar = html_entity_decode($kommentar, ENT_QUOTES);
            }
            $kommentar = addslashes($kommentar);
            $filename = $input[1];
            fputs($cf, "$filename=$kommentar\n");
          }
          fclose($cf);
        }

        echo "<script language=javascript>window.location.href='".$_SERVER["PHP_SELF"]."';</script>";
      }
      else
      {
        // Checks if there is a comment file

      $edit_flag = 0;

      if( (!file_exists($this->comments)) OR (!file_exists($this->description)) )
      {
          // Set flag: Lower part is displayed as well
          $edit_flag = 1;

          // Input form for page comment
          echo "<html>
          <head>
          <title>$this->title</title>
          <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
          <link rel=\"stylesheet\" href=\"pb.css\" type=\"text/css\">
          </head>
          <body>";

          echo "<table cellpadding='3' cellspacing='0' border='0' class='text'>";
          echo "<tr><td colspan='2' class='titel'>Retorte PictureBrowser: Kommentarerfassung</td></tr>";
          echo "<tr><td colspan='2'>&nbsp;</td></tr>";

          echo "<form name='comment' method='post' action='".$_SERVER["PHP_SELF"]."'>";
      }


        if(!file_exists($this->description))
        {

          // Check if old data exists
          $bestehende_desc = "";
          if(file_exists($this->description_old))
          {
            $best_desc_string_array = file($this->description_old);
            $best_desc_string = implode("", $best_desc_string_array);
            $best_desc_string = htmlentities($best_desc_string, ENT_QUOTES);
            $bestehende_desc = stripslashes($best_desc_string);
          }

          // Create file for preventing a second call of input form (semaphore style)
          $filecreate = touch($this->description);
          if(!$filecreate) die("Script konnte keine Datei erzeugen!");

          echo "<tr><td colspan='2'>Seitenkommentar:</td></tr>";
          echo "<tr><td colspan='2'>";
          echo "<textarea name='beschreibung' cols='80' rows='6' wrap='physical'>$bestehende_desc</textarea>";
          echo "</td></tr>";

          echo "<tr><td colspan='2'>&nbsp;</td></tr>";
          echo "<tr><td colspan='2'>&nbsp;</td></tr>";


        }




        if(!file_exists($this->comments))
        {
          // Check if old comment data exists
          $comment_flag = 0;
          if(file_exists($this->comments_old))
          {
            $comment_flag = 1;
            $best_kommentar_array = file($this->comments_old);
          }
        // Create file for preventing a second call of input form (semaphore style)
        $filecreate = touch($this->comments);
        if(!$filecreate) die("Script konnte keine Datei erzeugen!");


          while($picout = each($this->pictures))
          {
              $bestehender_kommentar = "";
              if($comment_flag==1)
              {
                while($kommentarout = each($best_kommentar_array))
                {
                  $kommentarteile = explode("=", trim($kommentarout[1]));

                  if(trim($kommentarteile[0])==$picout[1])
                  {
                    $bestehender_kommentar = $kommentarteile[1];
                    $bestehender_kommentar = htmlentities($bestehender_kommentar, ENT_QUOTES);
                    $bestehender_kommentar = stripslashes($bestehender_kommentar);

                  }
                }
              }
              echo "<tr><td><img src='pb_img.php?pic_name=".$picout[1]."&tb=".$this->prev_width."&tnm=2' height='".$this->prev_width."' width='".$this->prev_width."' border='0' class='image_border'><br/>$picout[1]</td><td>Kommentar f&uuml;r Bild \"$picout[1]\":<br/>
              <input type='text' value='$bestehender_kommentar' name='".$picout[0]."' size='80'></td></tr>\n";

              if($comment_flag==1)
              {
                reset($best_kommentar_array);
              }
          }


        }





        if($edit_flag==1)
        {
            echo "<tr><td>&nbsp;</td><td><input type='submit' name='submit' value='Speichern!'></td></tr>";
            echo "</form>";
            echo "</table>";

            echo "</body>
            </html>";

            // Prevent output of other stuff
            die();
        }

      }
      return $output;
    }

/*--------------------------------------------------------------------*/
/* Generate header information in HTML file                           */
/*--------------------------------------------------------------------*/
    function showHeader()
    {
      return $this->header;
    }

/*--------------------------------------------------------------------*/
/* Put new HTTP header to manipulate browser cache                    */ 
/*--------------------------------------------------------------------*/
    function putHTTPHeader()
    {
      // Get current time
      $aktuelleZeit = time();
      // Define time to wait
      $differenz = 3600;
      // Get past timestamp 
      $definierteZeitVergangen = $aktuelleZeit - $differenz;
      $definierteZeitZukunft = $aktuelleZeit + $differenz;

      // Constitute time things
      $headerZeitAngabe = date("D, d M Y H:i:s \G\M\T", $definierteZeitVergangen);
      $_SERVER["HTTP_IF_MODIFIED_SINCE"] = date("D, d M Y H:i:s \G\M\T", $definierteZeitZukunft);

      // Send HTTP header to browser
      header("Last-Modified: $headerZeitAngabe");
    }

/*--------------------------------------------------------------------*/
/* Throw some kind of exception                                       */
/*--------------------------------------------------------------------*/
    function show_error_message($errorcode)
    {
      print($errorcode);
      die();
    }


}  // class PICTURE_BROWSER




/*--------------------------------------------------------------------*/
/* Generate new instance of PB Class                                  */
/*--------------------------------------------------------------------*/
$PB = new PICTURE_BROWSER;

/*--------------------------------------------------------------------*/
/* Process page                                                       */
/*--------------------------------------------------------------------*/
echo $PB->processTemplates();

?>
 
Also....
das ist ja mal nicht grad wenig Code, aber soweit ich das im Schnelldurchlauf geblickt habe, sollte diese Anweisung im 2. Teil:
PHP:
 echo "<tr><td><img src='pb_img.php?pic_name=".$picout[1]."&tb=".$this->prev_width."&tnm=2' height='".$this->prev_width."' width='".$this->prev_width."' border='0' class='image_border'><br/>$picout[1]</td><td>Kommentar f&uuml;r Bild \"$picout[1]\":<br/>
<input type='text' value='$bestehender_kommentar' name='".$picout[0]."' size='80'></td></tr>\n";
durch diese ersetzt werden:
PHP:
 echo "<tr><td><img src='pb_img.php?pic_name=".$picout[1]."&tb=".$this->prev_width."&tnm=2' height='".$this->prev_width."' width='".$this->prev_width."' border='0' class='image_border'><br/>&nbsp;</td><td>Kommentar f&uuml;r Bild \"$picout[1]\":<br/>
<input type='text' value='$bestehender_kommentar' name='".$picout[0]."' size='80'></td></tr>\n";
Ich hab da jetzt nur das $picout[1] (Ich hoffe mal, der Bildname) duch ein &nbsp; (Ein Leerzeichen) ersetzt. Wenn der Bildname jetzt nicht mehr erscheint, dann gut. Evtl. kannst du dann sogar das &nbsp; und das <br/> davor weglassen, ich weiss jetzt aber nicht, welche Auswirkung das aufs Design hat.

Viel Glück, ich hoffe ich liege richtig,
DJ2K
 

Neue Beiträge

Zurück