Seite 1 von 1
Bildmodul
Verfasst: Di 9. Mai 2006, 15:56
von bipi
Hallo
Bin schon ein weile am suchen, hab aber nichts passendes gefunden, hoffe also jetzt auf eure hilfe.
ich möchte das standard bildmodul, das ja super funktioniert ein wenig modifizieren. Und zwar brauche ich bei der Galerieübersicht in der alle Bilder aufgelistet werden, nur jeweils den Titel für jedes Bild angezeit, und nicht wie in der normalen Bildergalerie die ganze Bildbeschreibung wie man sie in der Dateiverwaltung eingeben kann, die Beschreibung soll erst angezeigt werden wenn ein Bild ausgewählt wurde.
das heißt nochmal, jedes Bild soll nur den Bilditel in der Übersicht anzeigen, und erst nach dem anwählen soll die Beschreibung stehen.
hoffe es war verständlich
bitte bitte bitte
danke
bipi
Verfasst: Di 9. Mai 2006, 16:12
von i-fekt
Meinst du mit Bildtitel den Dateiname oder was?
Bildmodul
Verfasst: Di 9. Mai 2006, 16:14
von bipi
muss nicht der dateiname sein
in der Dateiverwaltung kann man ja für jedes Bild einen Mediennamen vergeben, dieser wäre ideal, oder ansonsten einfach einen Titel vergeben zu können, wäre super
danke
bipi
Bildmodul
Verfasst: Mi 10. Mai 2006, 06:31
von bipi
bitte bitte bitte wäre sehr wichtig.
Bildmodul
Verfasst: Do 11. Mai 2006, 05:35
von bipi
hallo
die Beschreibung für die Galerieübersicht zu entfernen war ja nicht so schwer, ich hab einfach nur im gallery_image.html template die {DESCRIBTION} entfernt, statt dieser Beschreibung wäre es super einen Bildtitel vergeben zu können.
hat niemand einen Idee?
bitte
bipi
Bildmodul
Verfasst: Fr 12. Mai 2006, 06:04
von bipi
hat wirklich niemand auch nur eine idee??
bitte
Re: Bildmodul
Verfasst: Fr 12. Mai 2006, 10:15
von Oldperl
bipi hat geschrieben:hat wirklich niemand auch nur eine idee??
bitte
Dazu müßte die Abfrage im Output-Teil des Moduls schon etwas verändert werden, da diese Daten in einer anderen DB-Tabelle gespeichert sind.
Gruß aus Franken
Ortwin
Bildmodul
Verfasst: Fr 12. Mai 2006, 16:04
von bipi
danke für den ansatz
welcher Teil würde geändert werden:
/////////////////
<?php
/***********************************************
* Bildergalerie Output
*
* Author : Timo A. Hummel
* Copyright : four for business AG
* Created : 30-09-2005
************************************************/
cInclude("includes", "functions.api.images.php");
/* Gallery variables */
$bRecursive = false;
$sPath = "CMS_VALUE[5]";
if ($sPath=='') {
$sPath = $cfgClient[$client]["path"]["frontend"] . $cfgClient[$client]["upl"]["frontendpath"] . "bildergalerie/";
} else {
$sPath = $cfgClient[$client]["path"]["frontend"] . $cfgClient[$client]["upl"]["frontendpath"] . "CMS_VALUE[5]";
}
$iRows = "CMS_VALUE[3]";
if ($iRows == 0)
{
$iRows = 2;
}
$iColumns = "CMS_VALUE[2]";
if ($iColumns == 0)
{
$iColumns = 2;
}
if (isset($start))
{
$iCurrentPage = $start;
} else {
$iCurrentPage = 1;
}
$iWidth = "CMS_VALUE[0]";
$iHeight = "CMS_VALUE[1]";
if ($iWidth == 0)
{
$iWidth = 300;
}
if ($iHeight == 0)
{
$iHeight = 300;
}
$iDetailWidth = "CMS_VALUE[4]";
if ($iDetailWidth == 0)
{
$iDetailWidth = 300;
}
$aValidExtensions = array("jpg", "jpeg", "gif", "png");
$iImagesPerPage = $iRows * $iColumns;
if ($_REQUEST['view']=='') {
/* Read all gallery files */
$aGalleryFiles = scanDirectory($sPath, $bRecursive);
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);
$link = 'front_content.php?idcatart='.$idcatart.'&start='.$_REQUEST['start'].'&view='.urlencode(str_replace($cfgClient[$client]['path']['frontend'],'',$sImageToDisplay));
$description = ig_getImageDescription($sImageToDisplay);
if ($description=='') {
$description = ' ';
}
$download_link = str_replace($cfgClient[$client]['path']['frontend'],$cfgClient[$client]['path']['htmlpath'],$sImageToDisplay);
$download_size = ig_GetReadableFileSize($sImageToDisplay);
$oImageTpl->reset();
$oImageTpl->set("s", "FILE", $sScaledImage);
$oImageTpl->set("s", "WIDTH", $iWidth);
$oImageTpl->set("s", "HEIGHT", $iHeight);
$oImageTpl->set("s", "LINK", $link);
$oImageTpl->set("s", "DESCRIPTION", $description);
$oImageTpl->set("s", "DOWNLOAD_LINK", $download_link);
$oImageTpl->set("s", "DOWNLOAD_SIZE", $download_size);
$oImageTpl->set("s", "DOWNLOAD_CAPTION", mi18n("Detailansicht"));
$oImageTpl->set("s", "PREVIEW_CAPTION", mi18n("Vorschau"));
$aRenderedImages[] = $oImageTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/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/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]["path"]["htmlpath"] . sprintf("front_content.php?idcatart=%s&start=%s", $idcatart, $iCurrentPage - 1));
$oPreviousTpl->set("s", "TITLE", mi18n("Zurück"));
$aLinks[] = $oPreviousTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/gallery_link.html", true, false);
}
if ($iCurrentPage < $iPages)
{
$oNextTpl = new Template;
$oNextTpl->set("s", "LINK", $cfgClient[$client]["path"]["htmlpath"] . sprintf("front_content.php?idcatart=%s&start=%s", $idcatart, $iCurrentPage + 1));
$oNextTpl->set("s", "TITLE", mi18n("Vor"));
$aLinks[] = $oNextTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/gallery_link.html", true, false);
}
$oGalleryTpl->set("s", "NAVIGATION", implode("", $aLinks));
$oGalleryTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/gallery.html", false, false);
}
} else {
$sImageToDisplay = $cfgClient[$client]['path']['frontend'].$_REQUEST['view'];
$sScaledImage = cApiImgScale($sImageToDisplay, $iDetailWidth, 1000);
$description = ig_getImageDescription($sImageToDisplay);
if ($description=='') {
$description = ' ';
}
$download_link = str_replace($cfgClient[$client]['path']['frontend'],$cfgClient[$client]['path']['htmlpath'],$sImageToDisplay);
$download_size = ig_GetReadableFileSize($sImageToDisplay);
$oImageTpl = new Template;
$oImageTpl->set("s", "IMG",$sScaledImage);
$oImageTpl->set("s", "BACKLINK",'front_content.php?idcat='.$idcat.'&idart='.$idart.'&start='.$_REQUEST['start']);
$oImageTpl->set("s", "BACKCAPTION",mi18n("Zurück"));
$oImageTpl->set("s", "DESCRIPTION", $description);
$oImageTpl->set("s", "DOWNLOAD_LINK", $download_link);
$oImageTpl->set("s", "DOWNLOAD_SIZE", $download_size);
$oImageTpl->set("s", "DOWNLOAD_CAPTION", mi18n("Detailansicht"));
$oImageTpl->generate($cfgClient[$client]["path"]["frontend"] . "templates/gallery_detail.html", false, false);
}
function ig_getImageDescription($idupl){
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('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_GetReadableFileSize($path) {
$filesize = filesize($path);
$unit = "bytes";
if ($filesize > 1024) {
$filesize = ($filesize / 1024);
$unit = "kB"; }
if ($filesize > 1024) {
$filesize = ($filesize / 1024);
$unit = "MB"; }
if ($filesize > 1024) {
$filesize = ($filesize / 1024);
$unit = "GB"; }
if ($filesize > 1024) {
$filesize = ($filesize / 1024);
$unit = "TB"; }
$filesize = round($filesize, 0);
return $filesize." ".$unit;
}
?>
////////////////
vielen dank für eure hilfe
bipi
Verfasst: Fr 12. Mai 2006, 21:17
von Oldperl
Dieser Teil
Code: Alles auswählen
function ig_getImageDescription($idupl){
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('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 '';
}
}
Hier müßte dann die Abfrage nach den jeweiligen Daten rein, die dann im {DESCRIPTION}-Teil ausgegeben würden.
Gruß aus Franken
Ortwin
Bildmodul
Verfasst: Sa 13. Mai 2006, 08:51
von bipi
danke für den hinweis
die description sollte aber weiterhin bestehen bleiben.
also nur ein Bildtitel sollte eingefügt werden können.
danke
Verfasst: Sa 13. Mai 2006, 10:17
von Oldperl
Vorgehensweise:
+ Funktion kopieren und umbenennen, z.B. ig_getImageTitle($idupl).
+ Funktion auf die neue DB-Abfrage anpassen.
+ HTML- Output anpassen
disen Teil
Code: Alles auswählen
$description = ig_getImageDescription($sImageToDisplay);
if ($description=='') {
$description = ' ';
}
kopieren, Variable umbennen, z.B. so
Code: Alles auswählen
$img_title= ig_getImageTitle($sImageToDisplay);
if ($img_title=='') {
$img_title= ' ';
}
+ Im Templateteil folgende Zeile ergänzen
+ Im Template den Platzhalter einfügen {IMG_TITLE}
Fertig.
Mit Gruß aus dem regnerischen Franken
Ortwin
Bildmodul
Verfasst: Sa 13. Mai 2006, 19:04
von bipi
Hallo Vielen dank für deine Mühe
wie muss ich die funktion anpassen:
zur zeit hab ich sie nur umbenannt.
############
function ig_getImageTitle($idupl){
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('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 '';
}
}
#################
danke
liebe grüße
bipi
Verfasst: Sa 13. Mai 2006, 19:25
von i-fekt
@ Bibi:
Benutze doch bitte für Code auch die entsprechenden Formatierungsmöglichkeiten wenn ud einen Eintrag erstellst.
Bildmodul
Verfasst: So 14. Mai 2006, 18:05
von bipi
OK vielen dank
wie muss ich die funktion anpassen:
zur zeit hab ich sie nur kopiert und umbenannt.
Code: Alles auswählen
function ig_getImageTitle($idupl){
global $cfg, $cfgClient, $db, $client, $lang;
$cApiClient = new cApiClient($client);
$language_separator = $cApiClient->getProperty('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 '';
}
}
danke
liebe grüße
bipi