Sehr individuelles PHP Problem

benboom

Grünschnabel
Hallo Miteinander,

ich sollte einleitend sagen, dass ich von php im grunde keine ahnung habe.
Dennoch muss ich eine dynamische photo gallery erstellen.
Zu diesem Zweck habe ich ein kostenloses script verwendet und dieses angepasst.
Das Problem ist nun, dass beim klick auf ein thumbnail nur das eigentliche bild
(also z.B.: /html/bilder/16288367_2337465.jpg) erscheinen soll. Momentan wird durch das php-script jeweils eine komplette seite erstellt.

hier das script:
---------------------------------------------------------------------------
<?php echo;
$aa = file($config);
if(count($aa) == 0)
{echo "<span class=\"kommentar\">Es wurde noch kein Photoalbum angelegt</span>";}
else
{
echo "<form name=\"form1\" method=\"post\" action=\"$index\">
<select name=\"palbum\" class=\"albumform\" id=\"palbum\">
<option value=\"\" selected>Bitte Photoalbum ausw&auml;hlen</option>";
while (list ($line_num, $line) = @each($aa))
{
$ziffern = explode("&&", $line);
if($line_num == 0){$albumid = $ziffern[0];}
$idno = $ziffern[0];
$albumtitel = $ziffern[1];
echo "<option value=\"$idno\">$albumtitel</option>\n";
}
echo "</select>
<input name=\"Submit\" type=\"submit\" class=\"albumbutton\" value=\"Album zeigen\">
</form>";
}
?></font></div> </td>
</tr>
<?php
$palbum = $_POST[palbum];
$photo = $_GET[photo];
$album = $_GET[album];
$pos = $_GET[pos];
//Albumtitel
if($palbum == ""){$palbum = $album;}
if($palbum == ""){$palbum = $albumid;}
$t = file($config);
while (list ($line_num, $line) = @each($t))
{
$tt = explode("&&", $line);
if($tt[0] == $palbum) $albumtitel = $tt[1];
}
if(!empty($photo))
{
if($pos != "")
{
$df = "$path"."/"."$album".".txt";
$zr = file($df);
while (list ($line_num, $line) = @each($zr))
{
$nn = explode("&&", $line);
if($line_num == 0)
{$photo1 = $nn[0];}
if($line_num == $pos)
{$photo = $nn[0]; $f = "1";}
}
if($f != "1")
{$photo = $photo1;}
}
$photofile = "$url"."/images/"."$album"."_"."$photo".".jpg";
//Menue anzeigen
echo "<tr><td height=\"2\" colspan=\"1\"><a href=\"$url/$index?album=$album\" class=\"albumbutton\"> &nbsp;&nbsp;Photo schlie&szlig;en&nbsp;&nbsp;</a>&nbsp;&nbsp;&nbsp;<a href=\"$url/$index?album=$album#$photo\" class=\"albumbutton\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Zur&uuml;ck&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> </td></tr>";
//Photo anzeigen
$daten = "$path"."/"."$album".".txt";
$bilder = file($daten);
while (list ($line_num, $line) = @each($bilder))
{
$photos = explode("&&", $line);
if($photos[0]==$photo)
{
$zeile = $line_num;
$comment = "$photos[1]";
}}
$next = "$zeile" + "1";
$back = "$zeile" - "1";
echo "<tr><td height=\"2\" class=\"titel\"><img src=\"$photofile\" border=\"0\" alt=\"$comment\">";
echo "<br><span class=\"kommentar\">$comment</span><br>";
if($back >= 0)
{
echo "<a href=\"$url/$index?album=$album&pos=$back&photo=$photo\" class=\"albumbutton\"> &nbsp;&nbsp;vorheriges Photo&nbsp;&nbsp;</a>&nbsp;&nbsp;&nbsp;";
}
echo "<a href=\"$url/$index?album=$album&pos=$next&photo=$photo\" class=\"albumbutton\"> &nbsp;&nbsp;n&auml;chstes Photo&nbsp;&nbsp;</a>";
echo "</td></tr>";
}
?>
<tr>
<td height="2" class="Stil3"><div id="albumoverview">&Uuml;bersicht: <?php echo $albumtitel; ?></font></div> </td>
</tr>
<tr valign="top">
<td><span class="Stil2">
<?php

//&Uuml;bersichtsbilder anzeigen
echo "<table width=\"10%\" border=\"0\" cellpadding=\"4\" cellspacing=\"2\"><tr>";

$daten = "$path"."/"."$palbum".".txt";
$bilder = @file($daten);
if(empty($id)){$id="$bilder[0]";}
$anzahl = count($bilder);
$test = "$anzahl"/"$anzeige";
while(!is_integer($test))
{
$hinzu = "$anzahl"+"1";
$pad = "\n";
$bilder = @array_pad($bilder,$hinzu,$pad);
$anzahl = count($bilder);
$test = "$anzahl"/"$anzeige";
}

while (list ($line_num, $line) = @each($bilder))
{
$teiler = "$line_num"/"$anzeige";
$photos = explode("&&", $line);
$image = $photos[0];
$idalbum = $photos[2];
$image = chop($image);
$imagefile = "$idalbum"."_"."$image".".jpg";

$comment = $photos[1];
if(empty($image))
{
$c .= "<td>&nbsp;</td>";
}
if(!empty($image) and is_integer($teiler) and $line_num != "0")
{
$thumbnail = "$url"."/thumbnails/"."$imagefile";
$imageurl = "$url"."/images/"."$imagefile";
$c .= "</tr><tr><td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$url/$index?photo=$image&album=$idalbum\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}
if(!empty($image) and !is_integer($teiler) or $line_num == "0")
{
$imageurl = "$url"."/images/"."$imagefile";
$thumbnail = "$url"."/thumbnails/"."$imagefile";
$c .= "<td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$url/$index?photo=$image&album=$idalbum\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}
}
echo $c;
echo "</tr></table>";
?>
-------------------------------------------------------------------------------

Ich hoffe jemand kann mir behilflich sein.
Vielen Dank
ben
 
das Problem liegt in Zeile xx. ;)

PHP:
if(!empty($image) and is_integer($teiler) and $line_num != "0")
{
$thumbnail = "$url"."/thumbnails/"."$imagefile";
$imageurl = "$url"."/images/"."$imagefile";
$c .= "</tr><tr><td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$url/$index?photo=$image&album=$idalbum\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}

Das musste ändern in

PHP:
if(!empty($image) and is_integer($teiler) and $line_num != "0")
{
$thumbnail = "$url"."/thumbnails/"."$imagefile";
$imageurl = "$url"."/images/"."$imagefile";
$c .= "</tr><tr><td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$imageurl\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}

So sollte es normalerweise gehen, soweit ich den code überblicken kann.
 
Vielen Dank für die schnelle Antwort!
Hab den code sofort geändert. Leider besteht das Proplem weiterhin,
d.h es wird nach wie vor eine komplette seite generiert.

weiter Vorschläge?
 
Zurück