ich habe folgendes Problem ich brauche für die Lightbox Gallery zwei verschiedene Bilder da die Formate unterschiedlich sind.
die Bilder liegen in zwei verschiedenen Ortnern (pix_small & pix_big) man kann die ortner wählen siehe im input.
output
mein problem jetzt den Pfad so zu ändern das wenn ich auf das kleine Bild aus dem Ortner small_pix klicke, sich das grosse aus dem Ortner big_pix öffnet.
könnt ihr mir da helfen?
Besten Dank im voraus.
Grüße Pixelwerk
input
Code: Alles auswählen
?>
<table>
<tr>
<td><?php echo mi18n("Breite").' x '.mi18n("Höhe"); ?></td>
<td><input type="text" name="<?php echo "CMS_VAR[0]"; ?>" value="<?php echo "CMS_VALUE[0]"; ?>" style="width:40px;"> x <input type="text" name="<?php echo "CMS_VAR[1]"; ?>" value="<?php echo "CMS_VALUE[1]"; ?>" style="width:40px;"></td>
</tr><tr>
<td><?php echo mi18n("Spalten");?> x <?php echo mi18n("Zeilen");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[2]"; ?>" value="<?php echo "CMS_VALUE[2]"; ?>" style="width:40px;"> x <input type="text" name="<?php echo "CMS_VAR[3]"; ?>" value="<?php echo "CMS_VALUE[3]"; ?>" style="width:40px;"></td>
</tr>
<?php
$sql = "SELECT DISTINCT dirname FROM ".$cfg['tab']['upl']." ORDER BY dirname";
$db->query($sql);
echo '<tr><td>'.mi18n("Verzeichnis auswählen gross").'</td><td>
<select name="CMS_VAR[9]" size="1" style="width: 320px">
<option value="">'.mi18n("Nichts ausgewählt").'</option>';
while ($db->next_record()) {
if ( stristr($db->f("dirname"),'CVS/') === FALSE ) {
if ($db->f("dirname")=="CMS_VALUE[9]") {
echo '<option value="'.$db->f("dirname").'" selected="selected">'.$db->f("dirname").'</option>';
} else {
echo '<option value="'.$db->f("dirname").'">'.$db->f("dirname").'</option>';
}
}
}
echo '</select></td></tr>';?>
<?php
$sql1 = "SELECT DISTINCT dirname FROM ".$cfg1['tab']['upl']." ORDER BY dirname";
$db1->query($sql1);
echo '<tr><td>'.mi18n("Verzeichnis auswählen").'</td><td>
<select name="CMS_VAR[4]" size="1" style="width: 320px">
<option value="">'.mi18n("Nichts ausgewählt").'</option>';
while ($db1->next_record()) {
if ( stristr($db1->f("dirname"),'CVS/') === FALSE ) {
if ($db1->f("dirname")=="CMS_VALUE[4]") {
echo '<option value="'.$db1->f("dirname").'" selected="selected">'.$db1->f("dirname").'</option>';
} else {
echo '<option value="'.$db1->f("dirname").'">'.$db1->f("dirname").'</option>';
}
}
}
echo '</select></td></tr>';?>
<?php
$sort = "";
if("CMS_VALUE[5]" == "asc" || "CMS_VALUE[5]" == "") {
$asc = " checked";
} else {
$desc = " checked";
}
?>
<tr>
<td><?php echo mi18n("Sortierrichtung");?></td>
<td>
<input type="radio" name="CMS_VAR[5]" value="asc"<?php echo $asc; ?>> <?php echo mi18n("Aufsteigend"); ?>
<input type="radio" name="CMS_VAR[5]" value="desc"<?php echo $desc; ?>> <?php echo mi18n("Absteigend"); ?>
</td>
</tr><tr>
<td><?php echo mi18n("Zeichenanzahl");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[6]"; ?>" value="<?php echo "CMS_VALUE[6]"; ?>" style="width:40px;"></td>
</tr>
</table>
<?php
Code: Alles auswählen
<?php
cInclude("includes", "functions.api.images.php");
/* Gallery variables */
$bRecursive = false;
/* Input variables */
$iWidth = "CMS_VALUE[0]";
$iHeight = "CMS_VALUE[1]";
if ($iWidth == 0) {
$iWidth = 300;
}
if ($iHeight == 0) {
$iHeight = 300;
}
$iColumns = "CMS_VALUE[2]";
if ($iColumns == 0) {
$iColumns = 2;
}
$iRows = "CMS_VALUE[3]";
if ($iRows == 0) {
$iRows = 2;
}
$sPath = "CMS_VALUE[4]";
if ($sPath=='') {
$sPath = $cfgClient[$client]["path"]["frontend"] . $cfgClient[$client]["upl"]["frontendpath"] . "bildergalerie/";
} else {
$sPath = $cfgClient[$client]["path"]["frontend"] . $cfgClient[$client]["upl"]["frontendpath"] . "CMS_VALUE[4]";
}
$sPath1 = "CMS_VALUE[9]";
if ($sPath1=='') {
$sPath1 = $cfgClient[$client]["path1"]["frontend1"] . $cfgClient[$client]["upl"]["frontendpath"] . "bildergalerie/";
} else {
$sPath1 = $cfgClient[$client]["path1"]["frontend1"] . $cfgClient[$client]["upl"]["frontendpath"] . "CMS_VALUE[9]";
}
$sort = "CMS_VALUE[5]";
if( $sort == "asc" ) {
$sort = SORT_ASC;
} else {
$sort = SORT_DESC;
}
$words = "CMS_VALUE[6]";
if (isset($start)) {
$iCurrentPage = $start;
} else {
$iCurrentPage = 1;
}
$aValidExtensions = array("jpg", "jpeg", "gif", "png");
$iImagesPerPage = $iRows * $iColumns;
/* Read all gallery files */
$aGalleryFiles = scanDirectory($sPath, $bRecursive);
array_multisort($aGalleryFiles, $sort, SORT_STRING);
if (is_array($aGalleryFiles)) {
/* Filter out non-images */
foreach ($aGalleryFiles as $key => $aGalleryFile) {
$sExtension = strtolower(getFileExtension($aGalleryFile));
if (!in_array($sExtension, $aValidExtensions)) {
unset($aGalleryFiles[$key]);
}
}
/* Calculate effective variables */
$iFileCount = count($aGalleryFiles);
$iPages = ceil($iFileCount / $iImagesPerPage);
$aImagesToDisplay = array_slice($aGalleryFiles, ($iCurrentPage - 1) * $iImagesPerPage, $iImagesPerPage);
$oImageTpl = new Template;
$oGalleryTpl = new Template;
$oEmptyImageTpl = new Template;
$aRenderedImages = array();
$iRow = 0;
$iImagesRendered = 0;
foreach ($aImagesToDisplay as $sImageToDisplay) {
/* Do Scaling */
$sScaledImage = cApiImgScale($sImageToDisplay, $iWidth, $iHeight);
$sScaledImage = str_replace($cfgClient[$client]["path"]["htmlpath"],"",$sScaledImage);
$link = str_replace($cfgClient[$client]['path']['frontend'],$cfgClient['htmlpath'],$sImageToDisplay);
$media_name = ig_getMedienName($sImageToDisplay);
$link_description = ig_getImageDescription($sImageToDisplay);
if ($words != "" || $words != 0) {
# Cutting text but preserving words and entities
if(strlen($link_description) > $words){
$description = htmlentities(capiStrTrimAfterWord($link_description, $words)."...");
} else {
$description = "";
}
}
if( $media_name != "" && $link_description != "") {
$link_description = $media_name.': '.$link_description;
} elseif( $media_name != "" ) {
$link_description = $link_description;
} elseif( $description != "" ) {
$link_description = $link_description;
$media_name = " ";
}
echo $media_name;
$oImageTpl->reset();
$oImageTpl->set("s", "FILE", $sScaledImage);
$oImageTpl->set("s", "WIDTH", $iWidth);
$oImageTpl->set("s", "HEIGHT", $iHeight);
$oImageTpl->set("s", "LINK", $link1);
$oImageTpl->set("s", "MEDIANAME", $media_name);
$oImageTpl->set("s", "DESCRIPTION", $description);
$oImageTpl->set("s", "LINKDESCRIPTION", $link_description);
$aRenderedImages[] = $oImageTpl->generate($cfgClient[$client]["path1"]["frontend1"] . "templates/lightbox-gallery_image.html", true, false);
$iImagesRendered++;
if ($iImagesRendered == $iColumns) {
$oGalleryTpl->set("d", "COLUMNS", implode("", $aRenderedImages));
$oGalleryTpl->next();
$iImagesRendered = 0;
$aRenderedImages = array();
}
}
if (count($aRenderedImages) < $iColumns && count($aRenderedImages) > 0) {
$iEmptyCells = $iColumns - count($aRenderedImages);
$oEmptyImageTpl->set("s", "WIDTH", $iWidth);
$oEmptyImageTpl->set("s", "HEIGHT", $iHeight);
$sEmptyCells = str_repeat($oEmptyImageTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/lightbox-gallery_empty.html", true, false),$iEmptyCells);
$oGalleryTpl->set("d", "COLUMNS", implode("", $aRenderedImages) . $sEmptyCells);
$oGalleryTpl->next();
}
$aLinks = array();
if ($iCurrentPage > 1) {
$oPreviousTpl = new Template;
$oPreviousTpl->set("s", "LINK", $cfgClient[$client]["path1"]["htmlpath"] . sprintf("front_content.php?idcatart=%s&start=%s", $idcatart, $iCurrentPage - 1));
$oPreviousTpl->set("s", "TITLE", mi18n("Zurück"));
$aLinks[] = $oPreviousTpl->generate($cfgClient[$client]["path1"]["frontend1"] . "templates/lightbox-gallery_link.html", true, false);
}
if (($iCurrentPage < $iPages) && $iCurrentPage) {
$oNextTpl = new Template;
$oNextTpl->set("s", "LINK", $cfgClient[$client]["path1"]["htmlpath"] . sprintf("front_content.php?idcatart=%s&start=%s", $idcatart, $iCurrentPage + 1));
$oNextTpl->set("s", "TITLE", mi18n("Vor"));
$aLinks[] = $oNextTpl->generate($cfgClient[$client]["path1"]["frontend1"] . "templates/lightbox-gallery_link.html", true, false);
}
$oGalleryTpl->set("s", "NAVIGATION", implode("", $aLinks));
$oGalleryTpl->generate($cfgClient[$client]["path1"]["frontend1"] . "templates/lightbox-gallery.html", false, false);
}
function ig_getImageDescription($idupl){
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('language','separator');
if ($language_separator == "") {
//Sanity, if module used in client without set client setting
$language_separator = "§§§";
$cApiClient->setProperty('language','separator', $language_separator);
}
if(is_numeric($idupl)) {
//ID is a number
$query = "SELECT description FROM ".$cfg["tab"]["upl"]." WHERE idupl = ".$idupl;
} else {
//ID is a string
$path_parts = pathinfo($idupl);
$upload = $cfgClient[$client]['upl']['frontendpath'];
$len = strlen($upload);
$pos = strpos($idupl,$upload);
$dirname = substr($path_parts['dirname'],$pos+$len).'/';
$query = "SELECT description FROM ".$cfg["tab"]["upl"]." WHERE (dirname = '".$dirname."') AND (filename='".$path_parts['basename']."') AND (filetype='".$path_parts['extension']."')";
}
$db->query($query);
if($db->next_record()) {
return htmlspecialchars(urldecode($db->f("description")));
} else {
return '';
}
}
function ig_getMedienName($idupl) {
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('language','separator');
if ($language_separator == "") {
//Sanity, if module used in client without set client setting
$language_separator = "§§§";
$cApiClient->setProperty('language','separator', $language_separator);
}
if( is_numeric($idupl) ) {
//ID is a number
$query = "SELECT description FROM ".$cfg["tab"]["upl"]." WHERE idupl = ".$idupl;
} else {
//ID is a string
$path_parts = pathinfo($idupl);
$upload = $cfgClient[$client]['upl']['frontendpath'];
$len = strlen($upload);
$pos = strpos($idupl,$upload);
$dirname = substr($path_parts['dirname'],$pos+$len).'/';
$danis = $dirname.$path_parts['basename'];
$query = "SELECT value FROM ".$cfg["tab"]["properties"]." WHERE itemid = '".$dirname.$path_parts['basename']."' AND name = 'medianame'";
}
$db->query($query);
if( $db->next_record() ) {
return htmlspecialchars(urldecode($db->f("value")));
} else {
return '';
}
}
?>