Hi!
Bei diesem Script:
PHP-Code:
<script language="JavaScript" type="text/javascript">
<!--
function fenster(dateipfad, name, hoehe, breite, top, left) {
var neu;
neu = window.open(dateipfad, name, "width="+hoehe+",height="+breite+",top="+top+",left="+left+",scrollbars=1");
}
//-->
</script>
<?php
function showthumbs() {
$filecount = 0;
$filecounter = opendir("img/thumbnails");
while ($files = readdir($filecounter)) {
if (!is_dir($files) && $files!="Thumbs.db") {
++$filecount;
}
}
closedir($filecounter);
$direct=opendir("img/thumbnails");
$cols = 4;
$cellpadding = 5;
$i = 0;
if (!isset($_GET['gallerypage'])) { $_GET['gallerypage'] = "1"; }
if (isset($_GET['gallerypage'])) { $_GET['gallerypage'] = (int)$_GET['gallerypage']; }
if ($_GET['lang']=="en") {
$title = "Gallery";
$site = "Site";
}
if ($_GET['lang']=="de") {
$title = "Bilder";
$site = "Seite";
}
$width = (100*$cols)+($cellpadding*$cols*2);
echo "<div align=\"center\"><h2 style=\"Border:1px #3366FF solid; color:#3366FF;width:250px;\">$title</h2></div>";
$ga = 1;
echo "
[b]<u>$site:</u> ";
$filecounta = $filecount;
while ($filecounta>20) {
echo "<a href=\"index.php?lang=$_GET[lang]&link=6&gallerypage=$ga\" style=\"color: black;text-decoration:none;Border:1px #3366FF solid;Background-Color:white;display:block;float:left;width:15px;padding:2px;margin:2px;\">$ga<a>\n";
$filecounta-=20;
++$ga;
}
if ($filecounta>0) {
echo "<a href=\"index.php?lang=$_GET[lang]&link=6&gallerypage=$ga\" style=\"color: black;text-decoration:none;Border:1px #3366FF solid;Background-Color:white;display:block;float:left;width:15px;padding:2px;margin:2px;\">$ga<a>\n";
}
echo "[/b]
";
echo "<table align=\"center\"><tr>";
while ($file = readdir ($direct)) {
if (!is_dir($file) && $file!="Thumbs.db") {
$oberlimit = $_GET[gallerypage]*20;
$unterlimit = $oberlimit-20;
if ($i<$oberlimit && $i>=$unterlimit) {
$filesize = filesize("img/thumbnails/".$file);
$filesize = round($filesize/1024, 0);
$file = ereg_replace("( )", "%20", $file);
$d = ($i/$cols);
if (gettype($d)=="integer") {
echo "</tr>";
echo "<tr cellpadding=\"$cellpadding px\">";
echo "<td style=\"padding:3px;Border:1px #3366FF solid;Background-Color:#C2C2C2;text-align:center;color:maroon\">";
echo "<a href=\"javascript:fenster('viewgallery.php?file=$file&id=$i&lang=$_GET[lang]','Exmouth 2004','655px','800px','100px','100px')\" class=\"d\">";
echo "<img src=\"img/thumbnails/$file\" border=0>";
echo "</a>
[b]Size:[/b] $filesize KB</td>\n";
}
else {
echo "<td style=\"padding:3px;Border:1px #3366FF solid;Background-Color:#C2C2C2;text-align:center;color:maroon\">";
echo "<a href=\"javascript:fenster('viewgallery.php?file=$file&id=$i&lang=$_GET[lang]','Exmouth 2004','655px','800px','100px','100px')\" class=\"d\">";
echo "<img src=\"img/thumbnails/$file\" border=0 alt=$filesize>";
echo "</a>
[b]Size:[/b] $filesize KB</td>\n";
}
}
++$i;
}
}
closedir($direct);
echo "</table>";
$g = 1;
echo "
[b]<u>Seite:</u> ";
while ($filecount>20) {
echo "<a href=\"index.php?lang=$_GET[lang]&link=6&gallerypage=$g\" style=\"color: black;text-decoration:none;Border:1px #3366FF solid;Background-Color:white;display:block;float:left;width:15px;padding:2px;margin:2px;\">$g<a>\n";
$filecount-=20;
++$g;
}
if ($filecount>0) {
echo "<a href=\"index.php?lang=$_GET[lang]&link=6&gallerypage=$g\" style=\"color: black;text-decoration:none;Border:1px #3366FF solid;Background-Color:white;display:block;float:left;width:15px;padding:2px;margin:2px;\">$g<a>\n";
}
echo "[/b]
";
}
function make_thumbs() {
$verz=opendir ("img/original/");
while ($fileb = readdir ($verz)) {
if (!is_dir($fileb) && $fileb!="Thumbs.db") {
$groesse = "100";
$img_src = "img/original/".$fileb;
$img_height = "100";
$img_width = "100";
$im = imagecreatefromjpeg($img_src);
list($src_width, $src_height) = getimagesize($img_src);
if($src_width >= $src_height) {
$new_image_width = $img_width;
$new_image_height = $src_height * $img_width / $src_width;
}
if($src_width < $src_height) {
$new_image_height = $img_width;
$new_image_width = $src_width * $img_height / $src_height;
}
$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
imagecopyresampled($new_image, $im, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
imagejpeg($new_image, "img/thumbnails/".$fileb, 90);
}
}
closedir($verz);
}
function make_big() {
$verz=opendir ("img/original");
while ($fileb = readdir ($verz)) {
if (!is_dir($fileb) && $fileb!="Thumbs.db") {
$groesse = "100";
$img_src = "img/original/".$fileb;
$img_height = "480";
$img_width = "640";
$im = imagecreatefromjpeg($img_src);
list($src_width, $src_height) = getimagesize($img_src);
if($src_width >= $src_height) {
$new_image_width = $img_width;
$new_image_height = $src_height * $img_width / $src_width;
}
if($src_width < $src_height) {
$new_image_height = $img_width;
$new_image_width = $src_width * $img_height / $src_height;
}
$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
imagecopyresampled($new_image, $im, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
imagejpeg($new_image, "img/big/".$fileb, 90);
}
}
closedir($verz);
}
function pruefung() {
$digi = opendir("img/original");
$doriginal = 0;
while ($filedi = readdir($digi)) {
if (!is_dir($filedi) && $filedi!="Thumbs.db") {
++$doriginal;
}
}
closedir($digi);
$diga = opendir("img/thumbnails");
$dthumbs = 0;
while ($filedg = readdir($diga)) {
if (!is_dir($filedg) && $filedg!="Thumbs.db") {
++$dthumbs;
}
}
closedir($diga);
$digb = opendir("img/big");
$dbig = 0;
while ($filedbig = readdir($digb)) {
if (!is_dir($filedbig) && $filedbig!="Thumbs.db") {
++$dbig;
}
}
closedir($digb);
if ($doriginal==$dthumbs and $dbig==$dthumbs) {
showthumbs();
}
if (($doriginal!=$dthumbs) or ($dbig!=$dthumbs) or ($doriginal!=$dbig)) {
echo "Original: $doriginal
Thumbs: $dthumbs
big: $dbig";
make_thumbs();
make_big();
showthumbs();
}
}
pruefung();
?>
</body>
</html>
tritt bei meinem gemieteten Webspace dieser Fehler auf (daheim auf meinem Webserver funktioniert das Script ohne jegliche Fehlermeldung):
Fatal error: Allowed memory size of 16777216 bytes exhausted at (null):0 (tried to allocate 8192 bytes) in /home/htdocs/web79/html/exmouth2004/gallery.php on line 98
Liegt das am Server oder am Script???
thx
marce23