Hi Leute,
vielen Dank an alle, die hier im Forum posten. Nach vielem Lesen in sämtlichen Threads und unermüdliches Ausprobieren habe ich es geschafft.
Meine Gallerie funktioniert!!! Auch die Thumbnails werden angezeigt.
Achtung an alle mit dem gleichen Problem:
> es müssen die Pfadangaben stimmen
> die thumbnails müssen vor dem Dateinamen "thb_" lauten:
thb_dateiname.jpg und nicht nur dateiname.jpg
Für die, die es interessiert, hier die Quelltexte:
Code: Alles auswählen
Input:
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\">
<tr valign=\"top\">
<td>Einzelbild-Seite</td>
<td>
<select name=\"CMS_VAR[0]\">";
$sql = "SELECT * FROM $cfgTab_cat_tree AS TREE, $cfgTab_cat_side AS CATSIDE, $cfgTab_cat AS CAT, $cfgTab_cat_lang AS CATLANG, $cfgTab_side_lang AS SIDELANG WHERE TREE.idcat=CATSIDE.idcat AND CATSIDE.idcat=CATLANG.idcat AND CATLANG.idlang='$lang' AND CATSIDE.idside=SIDELANG.idside AND SIDELANG.idlang='$lang' AND CAT.idcat=TREE.idcat AND CAT.idclient='$client' ORDER BY TREE.idtree";
$db->query($sql);
if ($selected != 0) {
echo "<option value=0>diese Seite</option>";
} else {
echo "<option value=0 selected>diese Seite</option>";
}
while ($db->next_record()) {
$spaces = "";
for ($i=0; $i<$db->f("level"); $i++) {
$spaces = $spaces . " ";
}
if ( $db->f("idcatside") != $selected ) {
echo "<option value=\"".$db->f("idcatside")."\">$spaces ".$db->f("name")."---".$db->f("title")."</option>";
} else {
echo "<option value=\"".$db->f("idcatside")."\" selected>$spaces ".$db->f("name")."---".$db->f("title")."</option>";
}
}
echo "</select>";
echo " </td>
</tr>
<tr>
<td>
Image-Directory:
</td>
<td>
<input size=20 type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\">
</td>
</tr>
<tr>
<td>
Thumbnail-Directory:
</td>
<td>
<input size=20 type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\">
</td>
</tr>
<tr>
<td>
Image-Dateieendung (z.B. .jpg;.gif):
</td>
<td>
<input size=20 type=\"text\" name=\"CMS_VAR[4]\" value=\"CMS_VALUE[4]\">
</td>
</tr>
<tr>
<td>
Thumbnailtabelle in Spalten x Zeilen:
</td>
<td>
<input size=3 maxlength=2 type=\"text\" name=\"CMS_VAR[5]\" value=\"CMS_VALUE[5]\">x<input size=3 maxlength=2 type=\"text\" name=\"CMS_VAR[6]\" value=\"CMS_VALUE[6]\">
</td>
</tr>
<tr>
<td>
Thumbnailgrösse in XxY:
</td>
<td>
<input size=3 maxlength=2 type=\"text\" name=\"CMS_VAR[7]\" value=\"CMS_VALUE[7]\">x<input size=3 maxlength=2 type=\"text\" name=\"CMS_VAR[8]\" value=\"CMS_VALUE[8]\">
</td>
</tr>
<tr>
<td>
Pfad zum ImageMagick (optional):
</td>
<td>
<input size=20 type=\"text\" name=\"CMS_VAR[9]\" value=\"CMS_VALUE[9]\"></td>
</tr>
</table>";
Code: Alles auswählen
Output:
<?php
$imagedir="CMS_VALUE[2]";
$thumbnails="CMS_VALUE[3]";
$imagetypes=explode(";","CMS_VALUE[4]");
$rows="CMS_VALUE[6]";
$cols="CMS_VALUE[5]";
$thb_x_size="CMS_VALUE[7]";
$thb_y_size="CMS_VALUE[8]";
$image_idcat="CMS_VALUE[0]";
$image_idside="CMS_VALUE[1]";
$im_path="CMS_VALUE[9]";
//-- config ende -------------------------------------
function is_image($filename,$typearray) {
reset($typearray);
while($val=each($typearray)) {
if (strstr($filename,$val[value])!==false) {
return true;
}
}
}
//-- functions ende ----------------------------------
if (!isset($mmstart)) {
$mmstart=0;
}
// Anzeige eines Bildes oder Übersicht?
if ($subfile!="") {
// Bild anzeigen
echo "<img src=\"$subfile\">";
} else {
// Gallery anzeigen
$handle=opendir($imagedir);
echo "<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"5\">";
$n=0;
$filearray=Array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_image($file,$imagetypes)) {
$filearray[]=$file;
}
}
reset($filearray);
// skip images...
for ($n=0;$n<$mmstart;$n++)
$ffile=each($filearray);
$n=0;
while ($ffile=each($filearray)) {
$file=$ffile[value];
// generate thumbnail, if nessesairy. Now THIS is fun :)
// natuerlich nur, wenn imagemagick vorhanden ist...
if (!file_exists($thumbnails."/thb_".$file) ) {
if ($im_path!="") {
$cmd=$im_path."/convert -scale ".$thb_x_size."x".$thb_y_size." ".$imagedir."/".$file." ".$thumbnails."/thb_".$file;
exec($cmd);
// nochmal prüfen!
$thumbnail=file_exists($thumbnails."/thb_".$file);
} else
$thumbnail=false;
} else
$thumbnail=true;
if ($n%$cols==0)
echo "<tr>\n";
if ($image_idcat!=0)
$url=$sess->url("front_content.php?client=$client&lang=$lang&subid=$subid&idcatside=$image_idcat&subfile=".rawurlencode($imagedir."/".$file));
else
$url=$sess->url("front_content.php?client=$client&lang=$lang&subid=$subid&idcat=$idcat&idside=$idside&subfile=".rawurlencode($imagedir."/".$file));
echo "<td valign=\"middle\" align=\"center\" width=\"$thb_x_size\" height=\"$thb_y_size\"><a href=\"/contenido/cms/upload/bilder/einschulung/images/dw.php?file=$file\" target=\"dw\" onClick=\"MM_openBrWindow(\'/contenido/cms/upload/bilder/einschulung/images/dw.php?file=$file\',\'dw\',\'menubar=yes,scrollbars=yes,resizable=yes,width=700,height=400\')\">".($thumbnail ? "<img src=\"$thumbnails/thb_$file\" border=\"0\">":"$file")."</a></td>
\n";
$n++;
if ($n%$cols==0)
echo "</tr>\n";
// nur solange wie's not tut...
if ($n>=$rows*$cols)
break;
}
echo "<tr> <td colspan=\"$cols\" align=\"center\" height=\"35\" valign=\"middle\">";
if ($mmstart>0) {
$url=$sess->url("front_content.php?client=$client&lang=$lang&idcat=$idcat&subid=$subid&idside=$idside&mmstart=".($mmstart-$rows*$cols));
echo "<a href=\"$url\">vorherige Bilder...</a>";
}
echo " | zeige Bilder ".($mmstart+1)." - ".($mmstart+$n)." | ";
if ($n+$mmstart<count($filearray)) {
$url=$sess->url("front_content.php?client=$client&lang=$lang&idcat=$idcat&subid=$subid&idside=$idside&mmstart=".($mmstart+$rows*$cols));
echo "<a href=\"$url\">weitere Bilder...</a>";
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
} // Ende Gallery anzeigen
?>
Code: Alles auswählen
dw.php:
<?php
$file=$HTTP_GET_VARS["file"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Detail Ansicht</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><a href="javascript:" onClick="window.close()"; title="schliessen"><? echo "<img src=\"/contenido/cms/upload/bilder/einschulung/images/$file\" border=\"0\">" ?></a></td>
</tr>
</table>
</body>
</html>
Hier sind die Pfadangaben anzupassen:
Output:
href=\"/contenido/cms/upload/bilder/einschulung/images/dw.php?file=$file\" target=\"dw\" onClick=\"MM_openBrWindow(\'/contenido/cms/upload/bilder/einschulung/images/dw.php?
dw.php:
onClick="window.close()"; title="schliessen"><? echo "<img src=\"/contenido/cms/upload/bilder/einschulung/images/$file\" border=\"0\">" ?></a></td>
-------------------------------------------------------------------------------------
Das Detailwindow habe ich in das jeweilige Image-Verzeichnis gelegt und die Pfade wie Ihr seht entsprechend angepasst.
Diese Variante erfordert zwar für jede einzelne Galerie ein eigenes, angepasstes Modul, dafür funktioniert es aber endlich.
Bei aller Euphorie gibt es aber noch einen einzigen klitzekleinen Punkt, der mir noch nicht gefällt. Vielleicht gibt es ja jemanden, der dies auch noch klären kann:
Das Detailwindow passt sich nicht an die Größe des Bildes an > siehe:
http://zillmann.wiseko.com/contenido/cm ... 1&client=1
Gruß Wolfgang