Bitte helfen Sie mir über die Straße: PHP-Bildergalerie

Gesperrt
#ayshe
Beiträge: 445
Registriert: Do 25. Mär 2004, 10:04
Kontaktdaten:

Bitte helfen Sie mir über die Straße: PHP-Bildergalerie

Beitrag von #ayshe »

Hallo,

ich habe bei http://www.ppleyard.org.uk/software.php ein schönes php-Skript für Bildergalerien gefunden und möchte es direkt in ein Layout einer neuen Site einbauen. Ich habe soweit alles geschafft, aber leider bekomme ich nun folgende Fehlermeldung:
Warning: readdir(): supplied argument is not a valid Directory resource in /home/netsh21258/html/amazonwind/front_content.php(558) : eval()'d code on line 750
Muß ich in der front_content.php noch etwas ergänzen (wo ich übrigens grade mal auf 605 Zeilen und nicht auf 750 komme)? Oder in der config.php?

Hier mal der Code des Layouts, vielleicht kann mir jemand einen Tip geben:

Code: Alles auswählen

<?

// Feel free to edit these-------------------------------------------------------------------------------------
$pagename="galerie.php"; // change this if you change the name of the page
$title="AmazonWind Fotogalerie "; // change to your page title, e.g John Smith's Photos
$defaultthumbwidth=67; // change the default width of thumbnails
//$frontpageimage="photos/gallery/image.jpg"; // change this to be the image you have on the front page (if commented, no image is shown)

// Do not edit below this line --------------------------------------------------------------------------------

// Register Global Variables
$action = $_GET['action'];
$gallery = $_GET['gallery'];
$dir = $_GET['dir'];
$filename = $_GET['filename']; 

// Change thumbnail size and set cookie if needed
if ($newthumbsize=="small") {
setcookie ("thumb_width_cookie", "67",time()+864000, "/", "", 0);
$thumb_width_cookie="67";
} elseif ($newthumbsize=="medium") {
setcookie ("thumb_width_cookie", "98",time()+864000, "/", "", 0);
$thumb_width_cookie="98";
} elseif ($newthumbsize=="large") {
setcookie ("thumb_width_cookie", "175",time()+864000, "/", "", 0);
$thumb_width_cookie="175";
} else {
$thumb_width="$defaultthumbwidth";
}

// Change thumbnail size
if ($thumb_width_cookie=="67") {
$thumb_width="67";
} elseif ($thumb_width_cookie=="98") {
$thumb_width="98";
} elseif ($thumb_width_cookie=="175") {
$thumb_width="175";
} else {
$thumb_width="$defaultthumbwidth";
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
	<title><? echo $title; ?></title>
<link href="css/galerie.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" href="css/screen.css" type="text/css" />
</head>

<body>
<div id="metadiv">

<div id="header-links">
	<div id="hinterrad"></div>
	<div id="navlinks">CMS_CONTAINER[1]</div>
	<div id="headerlinks-footer"></div>
</div><!-- ende "header-links" -->


<div id="header-rechts">

	<div id="logotype"><a href="index.html"><span>Home</span></a></div>
		<div id="mainnav">
		CMS_CONTAINER[2]
		</div> 
</div><!-- ende div "header-rechts" -->
	

<div id="center">
	<div id="centercontent">
	
	<!-- Galerie php beginnt hier -->
	<div id="wrapper">
<div id="container">

<? // Show the header/title and dynamically change the links depending on what page you are on ?>

<div id="toparea">
<div class="topgallerytitle">
<a href="http://www.amazonwind.de/amazonwind/front_content.php?idcat=12"><span><? echo $title; ?></span></a>
<?
if ($action=="gallery") {
   echo " : $gallery";
} elseif ($action=="image") {
   echo " : <a href=\"$pagename?action=gallery&gallery=$gallery\"><span>$gallery</span></a> : Fotoanzeige (<a href=\"$pagename?action=gallery&gallery=$gallery\">Zur&uuml;ck</a>)";
};
?>

</div>
</div>

<? // Show the top navigation bar ?>

<div class="navitems">

	
	<?
	if ($action=="gallery") {
	
	?>
	<strong>Größe Vorschaubild</strong><br />
    <a href="<? echo $pagename; ?>?action=gallery&gallery=<? echo $gallery; ?>&newthumbsize=large"><div class="thumb_large"></div></a>
	<a href="<? echo $pagename; ?>?action=gallery&gallery=<? echo $gallery; ?>&newthumbsize=medium"><div class="thumb_medium"></div></a>
	<a href="<? echo $pagename; ?>?action=gallery&gallery=<? echo $gallery; ?>&newthumbsize=small"><div class="thumb_small"></div></a>
	<br /><br /><br />
	
	<? } elseif ($action=="image") {
	$photoforsize="$dir/$filename";
	$information=getimagesize($photoforsize); 
	?>
	
	<strong>Angezeigtes Foto</strong><br />
	Größe: <? echo "(".$information[0]."px by ".$information[1]."px)"; ?><br />
	Galerie: <? echo $gallery; ?><br />
	<? echo "<a href=\"$dir/$filename\">"; ?>Bild in Originalgröße zeigen</a>
	
	<? } elseif ($action=="") {
	?>
	
	<strong>Informationen</strong><br />
	
<?php
$totalnooffiles=0;
  $filelist = explode("\n",`find .|sort`);
  for ($count=0;$count<count($filelist);$count++) {
  $filename=$filelist[$count];
    if (!is_dir($filename))
      $totalnooffiles=$totalnooffiles+1;
  }
  echo  "Anzahl Photos: ".number_format($totalnooffiles)."<br />";

$totalsize=0;

?> 
	
	<br /><br /><br />
	
	<?
	
	} else {
	} ?>
	

</div>

<div id="photoarea">

<?
if ($action=="") {
   if ($frontpageimage=="") {}
   else {
?>
<img src="phpthumb/phpThumb.php?src=../<? echo $frontpageimage; ?>&w=500&q=90" width="500" alt="<? echo $frontpageimage; ?>" class="bigimage" />
<?
   }
  
echo '<div id="homepagearea">';

// List Galleries on the Home Page

echo "<table width=\"520\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">";
$count=0;
echo "<tr>";

// cycles through directories and prints the name, in three columns
$BASEDIR="photos";    
       while($file=readdir($hndl)) {
               if ($file=='.' || $file=='..') continue;
                       $completepath="$BASEDIR/$file";
                       if (is_dir($completepath)) {

                          if ($count==3) { // change if you want extra/fewer columns
                             echo "
                             </tr><tr>
                             ";
                             $count=1;
                          } else {
                             $count=$count+1;
                          }   
					   
                          echo "<td width=\"240\"><a href=\"galerie/$pagename?action=gallery&gallery=$file\"><div>$file</div><br /></a></td>";
                     

					 
					   } else {
                       }
       }
	  
	  echo "
      </tr></table>
      ";
	  
       echo '</div>';
	   
} elseif ($action=="gallery") {

// List Images in the Gallery (on a Gallery Page)
$image = array("jpg", "png", "jpeg", "gif");
$directory='galerie/photos/';
$directory.=$gallery;
$mydir = dir($directory);
  

   echo "<table width=\"500\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
   $count=0;
   echo "<tr>";

   while(($file = $mydir->read()) !== false) {

for ($i = 0; $i < count($image); $i++)
       {
           if (eregi("\.". $image[$i] ."$", $file))
           {
		// 10, 7 or 4   
		
if ($thumb_width=="67") {

if ($count==10) {
echo "
</tr><tr>
";
$count=1;
} else {
$count=$count+1;
}


} elseif ($thumb_width=="98") {


if ($count==7) {
echo "
</tr><tr>
";
$count=1;
} else {
$count=$count+1;
}

} elseif ($thumb_width=="175") {


if ($count==4) {
echo "
</tr><tr>
";
$count=1;
} else {
$count=$count+1;
}

}


echo "
<td><a href=\"$pagename?action=image&gallery=$gallery&dir=$directory&filename=$file\">
<img src=\"phpthumb_thumb/phpThumb.php?src=photos/$gallery/$file&w=$thumb_width&q=90\" width=\"$thumb_width\" class=\"smallimage\" alt=\"$file\" /></a></td>
";              
           }
       }



   }
echo "
</tr></table>
";

?>
<div class="bottomline">
</div>
<br />

<?

} elseif ($action=="image") {

// Show specific image

// If it is a large image, use the resizing option

if ($information[0]>500) {

echo "<img src=\"phpthumb/phpThumb.php?src=../$dir/$filename&w=500&q=90\" width=\"500\" alt=\"$filename\" class=\"bigimage\" />";

}

// If it is smaller, show the original image

else {

echo "<img src=\"$dir/$filename\" alt=\"$filename\" class=\"bigimage\" />";

}

// Look for the comments file, and show it if availiable
// $comments_filename = "$dir/$filename.txt"; 

// if (file_exists($comments_filename)) {  
//     echo '<div id="comment">';  
//   include $comments_filename;  
//    echo '</div>';  
//} else {  
//   echo "<div id=\"comment\">Keine Beschreibung vorhanden</div>";  
//}


} else {

};
?>
<br /><br />

<div class="footer">Gallery powered by <a href="http://www.ppleyard.org.uk/software.php">SimplePhotos</a></div>

</div>

</div>
</div>


	<!-- Ende der Galerie php -->
</div>
<div id="navrechts"></div> 

</div><!-- ende "center" -->
<br clear="all" />
<div id="footer">
CMS_CONTAINER[3]
</div>


</div><!-- ende "metadiv" -->
</body>
</html>
Die für das Skript erforderlichen Ordner sind angelegt und die Pfade stimmen auch.

Das Ganze soll auf 4.4.5 laufen; und am besten nach einem Upgrade später mal auf 4.5.x auch :-)

Viele Grüße,
Ayshe
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Re: Bitte helfen Sie mir über die Straße: PHP-Bildergalerie

Beitrag von emergence »

#ayshe hat geschrieben:

Code: Alles auswählen

Warning: readdir(): supplied argument is not a valid Directory resource in /home/netsh21258/html/amazonwind/front_content.php(558) : eval()'d code on line 750
Muß ich in der front_content.php noch etwas ergänzen (wo ich übrigens grade mal auf 605 Zeilen und nicht auf 750 komme)? Oder in der config.php?
ähm, supplied argument is not a valid Directory resource
aufgrund der meldung -> der pfad stimmt nicht

-> front_content.php(558) -> bedeutet das ein code evaluiert wird und zwar bei zeile 558 in der front_content.php und dieser code verursacht einen fehler bei zeile 750
*** make your own tools (wishlist :: thx)
#ayshe
Beiträge: 445
Registriert: Do 25. Mär 2004, 10:04
Kontaktdaten:

Beitrag von #ayshe »

Tjä, Pfade stimmen alle. Das ist ja mal wieder seltsam.
Ich habe das Ganze jetzt mal für vorläufig per iframe gelöst.

Aber wenn jemand das Skript so aufsplitten könnte, dass man es als Modul verwenden kann, wäre das klasse. Oder wenn mir jemand Tips gibt, wie ich dazu vorgehen muß.

Bis denn,
Ayshe
Gesperrt