Lightbox-Bildergalerie

chriz_the_wiz
Beiträge: 27
Registriert: Fr 23. Jun 2006, 14:13
Kontaktdaten:

Beitrag von chriz_the_wiz » Di 20. Nov 2007, 10:53

Falls es jemand braucht:

Um das Modul multimandantenfähig zu machen müßt ihr die folgende Zeile:

Code: Alles auswählen

  $sql = "SELECT DISTINCT dirname FROM ".$cfg['tab']['upl']." ORDER BY dirname";
durch die hier ersetzen

Code: Alles auswählen

  $sql = "SELECT DISTINCT dirname FROM ".$cfg['tab']['upl']." WHERE idclient = ".$client." ORDER BY dirname";
Bis denne,

Chriz

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

modul output ist rot

Beitrag von cubig » Fr 30. Nov 2007, 21:33

Hallo zusammen,

ich habe das modul angelegt und den text entsprechend kopiert - jedoch steht die ausgabe auf "rot".
Ich kann keinen Fehler entdecken...

Weiss jemand Rat?

Vielen Dank


Contenido 4.6.15

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » So 2. Dez 2007, 12:53

/contenido/contenido/includes/include.con_editcontent.php(618) : eval()'d code on line 455


Das bekokmme ich als Fehlermeldung wenn ich auf den Editor gehe.

und das wenn ich auf Vorschau klicke
/contenido/contenido/external/backendedit/front_content.php(890) : eval()'d code on line 319
Weis niemand einen Rat?

Fehlen Infos? Ich habe den Text einfach nur Kopiert....

Faar
Beiträge: 1915
Registriert: Sa 8. Sep 2007, 16:23
Wohnort: Brandenburg
Kontaktdaten:

Beitrag von Faar » So 2. Dez 2007, 13:05

kannst du genauer beschreiben was du alles kopiert hast und was dann geschehen ist?

Manchmal hilft eine neuerliche Installation, weil iegendwas beim kopieren verloren gegangen ist. Sowas gibt's.

Sieht für mich erstmal so aus, als ob hinter eval() ein Punkt oder ein Semikolon fehlt, weil es gleich mit 'd weitergeht.

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » So 2. Dez 2007, 13:09

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]";
}

$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 = "&nbsp;"; 
		}
		
		$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", "MEDIANAME", $media_name);
		$oImageTpl->set("s", "DESCRIPTION", $description);
		$oImageTpl->set("s", "LINKDESCRIPTION", $link_description);
		
		$aRenderedImages[] = $oImageTpl->generate($cfgClient[$client]["path"]["frontend"] . "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) {
		$o
PreviousTpl = 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/lightbox-gallery_link.html", true, false);
	}
	
	if (($iCurrentPage < $iPages) && $iCurrentPage) {
		$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/lightbox-gallery_link.html", true, false);
	}
	
	$oGalleryTpl->set("s", "NAVIGATION", implode("", $aLinks));
	
	$oGalleryTpl->generate($cfgClient[$client]["path"]["frontend"] . "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 '';
	}
}
?>
Also so habe ich den Code in der Ausgabe stehn.

Faar
Beiträge: 1915
Registriert: Sa 8. Sep 2007, 16:23
Wohnort: Brandenburg
Kontaktdaten:

Beitrag von Faar » So 2. Dez 2007, 13:15

da ist noch eine Include dabei, ganz am Anfang.
cInclude("includes", "functions.api.images.php")

Was steht in der?

Und heut kann ich da sicher nichts machen, muss arbeiten... :cry:
Vielleicht finden andere ja was?

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » So 2. Dez 2007, 13:27

Code: Alles auswählen

<?php

/*****************************************
* File      :   $RCSfile: functions.api.images.php,v $
* Project   :   Contenido
* Descr     :   Contenido Image API functions
*
* Author    :   Timo A. Hummel
*               
* Created   :   08.08.2003
* Modified  :   $Date: 2006/10/05 23:50:41 $
*
* © four for business AG, www.4fb.de
*
* $Id: functions.api.images.php,v 1.41 2006/10/05 23:50:41 bjoern.behrens Exp $
******************************************/

/* Info:
 * This file contains Contenido Image API functions.
 *
 * If you are planning to add a function, please make sure that:
 * 1.) The function is in the correct place
 * 2.) The function is documented
 * 3.) The function makes sense and is generically usable
 *
 */
 
 
/**
 * capiImgScaleGetMD5CacheFile: Returns the MD5 Filename used
 * for caching.
 *
 * @return string Path to the resulting image
 */
function capiImgScaleGetMD5CacheFile ($sImg, $iMaxX, $iMaxY, $bCrop, $bExpand)
{
	if (!file_exists($sImg))
	{
		return false;	
	}
	
	$iFilesize = filesize($sImg);
	
	if (function_exists("md5_file"))
	{
		$sMD5 = md5(implode("", array(
					$sImg,
					md5_file($sImg),
					$iFilesize,
					$iMaxX,
					$iMaxY,
					$bCrop,
					$bExpand)));
	} else {
		$sMD5 = md5(implode("", array(
					$sImg,
					$iFilesize,
					$iMaxX,
					$iMaxY,
					$bCrop,
					$bExpand)));		
	}
	
	return $sMD5;
}

/**
 * capiImgScaleLQ: Scales (or crops) an image.
 * If scaling, the aspect ratio is maintained.
 *
 * Returns the path to the scaled temporary image.
 *
 * Note that this function does some very poor caching;
 * it calculates an md5 hash out of the image plus the
 * maximum X and Y sizes, and uses that as the file name.
 * If the file is older than 10 minutes, regenerate it.
 *
 * @param $img string The path to the image (relative to the frontend)
 * @param $maxX int The maximum size in x-direction
 * @param $maxY int The maximum size in y-direction
 * @param $crop boolean If true, the image is cropped and not scaled.
 * @param $expand boolean If true, the image is expanded (e.g. really scaled).
 *                        If false, the image will only be made smaller. 
 * @param $cacheTime int The number of minutes to cache the image  
 *
 * @return string Path to the resulting image
 */
function capiImgScaleLQ ($img, $maxX, $maxY, $crop = false, $expand = false, $cacheTime = 10)
{
	global $cfgClient, $lang, $client;

	$filename = $img;
	$defaultCacheTime = $cacheTime;
	
	$filetype = substr($filename, strlen($filename) -4,4);
	$filesize = filesize($img);
	$md5 = capiImgScaleGetMD5CacheFile($img, $maxX, $maxY, $crop, $expand);
	
	/* Create the target file names for web and server */
	$cfileName = $md5.".jpg";
	$cacheFile = $cfgClient[$client]["path"]["frontend"]."cache/".$cfileName;
	$webFile = $cfgClient[$client]["path"]["htmlpath"]."cache/".$cfileName;
	
	/* Check if the file exists. If it does, check if the file is valid. */
	if (file_exists($cacheFile))
	{
		if (!function_exists("md5_file"))
		{
			if ((filemtime($cacheFile) + (60 * $defaultCacheTime)) < time())
			{
				/* Cache time expired, unlink the file */
				unlink($cacheFile);	
			} else {
				/* Return the web file name */
				return $webFile;
			}
		} else {
			return $webFile;	
		}
	}
	
	/* Get out which file we have */
	switch (strtolower($filetype))
	{
		case ".gif": $function = "imagecreatefromgif"; break;
		case ".png": $function = "imagecreatefrompng"; break;
		case ".jpg": $function = "imagecreatefromjpeg"; break;
		case "jpeg": $function = "imagecreatefromjpeg"; break;
		default: return false;
	}
	
	if (function_exists($function))
	{
		$imageHandle = @$function($filename);
	}
	
	/* If we can't open the image, return false */
	if (!$imageHandle)
	{
		return false;
	}


	$x = imagesx($imageHandle);
	$y = imagesy($imageHandle);
	
	/* Calculate the aspect ratio */	
	$aspectXY = $x / $y;
	$aspectYX = $y / $x;
	
	if (($maxX / $x) < ($maxY / $y))
	{
		$targetY = $y * ($maxX / $x);
		$targetX = round($maxX);
		
		// force wished height
		if ($targetY < $maxY)
		{
			$targetY = ceil($targetY);
		} else
		{
			$targetY = floor($targetY);
		}
		
	} else {
		$targetX = $x * ($maxY / $y);
		$targetY = round($maxY);
		
		// force wished width
		if ($targetX < $maxX)
		{
			$targetX = ceil($targetX);
		} else
		{
			$targetX = floor($targetX);
		}
	}

	if ($expand == false && (($targetX > $x) || ($targetY > $y)))
	{
		$targetX = $x;
		$targetY = $y;	
	}

	$targetX = ($targetX != 0) ? $targetX : 1;
   	$targetY = ($targetY != 0) ? $targetY : 1;
   	
	/* Create the target image with the target size, resize it afterwards. */
   if ($crop)
   {
      /* Create the target image with the max size, crop it afterwards. */
      $targetImage = imagecreate($maxX, $maxY);
      imagecopy($targetImage, $imageHandle, 0, 0, 0, 0, $maxX, $maxY);
   } else {
      /* Create the target image with the target size, resize it afterwards. */
      $targetImage = imagecreate($targetX, $targetY);
      imagecopyresized($targetImage, $imageHandle, 0, 0, 0, 0, $targetX, $targetY, $x, $y);
   }
	
	/* Output the file */
	imagejpeg($targetImage, $cacheFile);
	
	return ($webFile);
}

/**
 * capiImgScaleHQ: Scales (or crops) an image in high quality.
 * If scaling, the aspect ratio is maintained.
 *
 * Note: GDLib 2.x is required!
 *
 * Returns the path to the scaled temporary image.
 *
 * Note that this function does some very poor caching;
 * it calculates an md5 hash out of the image plus the
 * maximum X and Y sizes, and uses that as the file name.
 * If the file is older than the specified cache time, regenerate it.
 *
 * @param $img string The path to the image (relative to the frontend)
 * @param $maxX int The maximum size in x-direction
 * @param $maxY int The maximum size in y-direction
 * @param $crop boolean If true, the image is cropped and not scaled.
 * @param $cacheTime int The number of minutes to cache the image  
 *
 * @return string Path to the resulting image
 */
function capiImgScaleHQ ($img, $maxX, $maxY, $crop = false, $expand = false, $cacheTime = 10)
{
	global $cfgClient, $lang, $client;

	$filename = $img;
	$defaultCacheTime = $cacheTime;
	
	$filetype = substr($filename, strlen($filename) -4,4);
	$filesize = filesize($img);
	$md5 = capiImgScaleGetMD5CacheFile($img, $maxX, $maxY, $crop, $expand);
	
	/* Create the target file names for web and server */
	$cfileName = $md5.".jpg";
	$cacheFile = $cfgClient[$client]["path"]["frontend"]."cache/".$cfileName;
	$webFile = $cfgClient[$client]["path"]["htmlpath"]."cache/".$cfileName;
	
	/* Check if the file exists. If it does, check if the file is valid. */
	if (file_exists($cacheFile))
	{
		if (!function_exists("md5_file"))
		{
			if ((filemtime($cacheFile) + (60 * $defaultCacheTime)) < time())
			{
				/* Cache time expired, unlink the file */
				unlink($cacheFile);	
			} else {
				/* Return the web file name */
				return $webFile;
			}
		} else {
			return $webFile;	
		}
	}
	
	/* Get out which file we have */
	switch (strtolower($filetype))
	{
		case ".gif": $function = "imagecreatefromgif"; break;
		case ".png": $function = "imagecreatefrompng"; break;
		case ".jpg": $function = "imagecreatefromjpeg"; break;
		case "jpeg": $function = "imagecreatefromjpeg"; break;
		default: return false;
	}
	
	if (function_exists($function))
	{
		$imageHandle = @$function($filename); 
	}
	
	/* If we can't open the image, return false */
	if (!$imageHandle)
	{
		return false;
	}


	$x = imagesx($imageHandle);
	$y = imagesy($imageHandle);

	/* Calculate the aspect ratio */	
	$aspectXY = $x / $y;
	$aspectYX = $y / $x;
	
	if (($maxX / $x) < ($maxY / $y))
	{
		$targetY = $y * ($maxX / $x);
		$targetX = round($maxX);
		
		// force wished height
		if ($targetY < $maxY)
		{
			$targetY = ceil($targetY);
		} else
		{
			$targetY = floor($targetY);
		}
		
	} else {
		$targetX = $x * ($maxY / $y);
		$targetY = round($maxY);
		
		// force wished width
		if ($targetX < $maxX)
		{
			$targetX = ceil($targetX);
		} else
		{
			$targetX = floor($targetX);
		}
	}
	
	if ($expand == false && (($targetX > $x) || ($targetY > $y)))
	{
		$targetX = $x;
		$targetY = $y;	
	}	

	$targetX = ($targetX != 0) ? $targetX : 1;
   	$targetY = ($targetY != 0) ? $targetY : 1;
   	
	/* Create the target image with the target size, resize it afterwards. */
if ($crop)
   {
      /* Create the target image with the max size, crop it afterwards. */
      $targetImage = imagecreatetruecolor($maxX, $maxY);
      imagecopy($targetImage, $imageHandle, 0, 0, 0, 0, $maxX, $maxY);
   } else {
      /* Create the target image with the target size, resize it afterwards. */
      $targetImage = imagecreatetruecolor($targetX, $targetY);
      imagecopyresampled($targetImage, $imageHandle, 0, 0, 0, 0, $targetX, $targetY, $x, $y);
   }
	
	/* Output the file */
	imagejpeg($targetImage, $cacheFile);
	
	return ($webFile);
}

/**
 * capiImgScaleImageMagick: Scales (or crops) an image using ImageMagick.
 * If scaling, the aspect ratio is maintained.
 *
 * Note: ImageMagick is required!
 *
 * Returns the path to the scaled temporary image.
 *
 * Note that this function does some very poor caching;
 * it calculates an md5 hash out of the image plus the
 * maximum X and Y sizes, and uses that as the file name.
 * If the file is older than the specified cache time, regenerate it.
 *
 * @param $img string The path to the image (relative to the frontend)
 * @param $maxX int The maximum size in x-direction
 * @param $maxY int The maximum size in y-direction
 * @param $crop boolean If true, the image is cropped and not scaled.
 * @param $cacheTime int The number of minutes to cache the image  
 *
 * @return string Path to the resulting image
 */
function capiImgScaleImageMagick ($img, $maxX, $maxY, $crop = false, $expand = false, $cacheTime = 10)
{
	global $cfgClient, $lang, $client;

	$filename = $img;
	$defaultCacheTime = $cacheTime;
	
	$filetype = substr($filename, strlen($filename) -4,4);
	$filesize = filesize($img);
	$md5 = capiImgScaleGetMD5CacheFile($img, $maxX, $maxY, $crop, $expand);
	
	/* Create the target file names for web and server */
	$cfileName = $md5.".jpg";
	$cacheFile = $cfgClient[$client]["path"]["frontend"]."cache/".$cfileName;
	$webFile = $cfgClient[$client]["path"]["htmlpath"]."cache/".$cfileName;
	
	/* Check if the file exists. If it does, check if the file is valid. */
	if (file_exists($cacheFile))
	{
		if (!function_exists("md5_file"))
		{
			if ((filemtime($cacheFile) + (60 * $defaultCacheTime)) < time())
			{
				/* Cache time expired, unlink the file */
				unlink($cacheFile);	
			} else {
				/* Return the web file name */
				return $webFile;
			}
		} else {
			return $webFile;	
		}
	}

	list($x, $y) = getimagesize($filename);	

	/* Calculate the aspect ratio */	
	$aspectXY = $x / $y;
	$aspectYX = $y / $x;
	
	if (($maxX / $x) < ($maxY / $y))
	{
		$targetY = $y * ($maxX / $x);
		$targetX = round($maxX);
		
		// force wished height
		if ($targetY < $maxY)
		{
			$targetY = ceil($targetY);
		} else
		{
			$targetY = floor($targetY);
		}
		
	} else {
		$targetX = $x * ($maxY / $y);
		$targetY = round($maxY);
		
		// force wished width
		if ($targetX < $maxX)
		{
			$targetX = ceil($targetX);
		} else
		{
			$targetX = floor($targetX);
		}
	}
	
	if ($expand == false && (($targetX > $x) || ($targetY > $y)))
	{
		$targetX = $x;
		$targetY = $y;	
	}
	
	$targetX = ($targetX != 0) ? $targetX : 1;
   	$targetY = ($targetY != 0) ? $targetY : 1;	

	// if is animated gif resize first frame
	if ($filetype == ".gif")
    {
		if (isAnimGif($filename))
        {
			$filename .= "[0]";
        }
    }

	/* Try to execute convert */
	$output = array();
	$retVal = 0;
	if ($crop)
	{
		exec ("convert -gravity center -quality 75 -crop {$maxX}x{$maxY}+1+1 \"$filename\" $cacheFile", $output, $retVal);
	} else {
		exec ("convert -quality 75 -geometry {$targetX}x{$targetY} \"$filename\" $cacheFile", $output, $retVal );
	}

	if (!file_exists($cacheFile))
	{
		return false;
	}
	
	return ($webFile);
}

/**
 * check if gif is animated
 *
 * @param string file path
 *
 * @return boolean true (gif is animated)/ false (single frame gif)
 */
function isAnimGif($sFile)
{
	$output = array();
	$retval = 0;
	
	exec('identify ' . $sFile, $output, $retval);
	
	if (count($output) == 1)
	{
		return false;
	}
	
	return true;	
}

/**
 * capiImgScale: Scales (or crops) an image.
 * If scaling, the aspect ratio is maintained.
 *
 * This function chooses the best method to scale, depending on
 * the system environment and/or the parameters.
 *
 * Returns the path to the scaled temporary image.
 *
 * Note that this function does some very poor caching;
 * it calculates an md5 hash out of the image plus the
 * maximum X and Y sizes, and uses that as the file name.
 * If the file is older than 10 minutes, regenerate it.
 *
 * @param $img string The path to the image (relative to the frontend)
 * @param $maxX int The maximum size in x-direction
 * @param $maxY int The maximum size in y-direction
 * @param $crop boolean If true, the image is cropped and not scaled.
 * @param $expand boolean If true, the image is expanded (e.g. really scaled).
 *                        If false, the image will only be made smaller. 
 * @param $cacheTime int The number of minutes to cache the image  
 * @param $wantHQ boolean If true, try to force high quality mode
 *
 * @return string Path to the resulting image
 */
function capiImgScale ($img, $maxX, $maxY, $crop = false, $expand = false, $cacheTime = 10, $wantHQ = false)
{
	global $client, $db, $cfg, $cfgClient;
	
	$deleteAfter = false;

    
	$sRelativeImg = str_replace($cfgClient[$client]["upl"]["path"], "", $img);
	if (is_dbfs($sRelativeImg))
	{
		// This check should be faster than a file existance check
		$dbfs = new DBFSCollection;
    			
		$file = basename($sRelativeImg);
    			
		$dbfs->writeToFile($sRelativeImg, $cfgClient[$client]["path"]["frontend"]."cache/".$file);
    			
		$img = $cfgClient[$client]["path"]["frontend"]."cache/".$file;
    	$deleteAfter = true;
	} else if (!file_exists($img))
	{
		/* Try with upload string */
		if (file_exists($cfgClient[$client]["upl"]["path"].$img) && !is_dir($cfgClient[$client]["upl"]["path"].$img))
		{
			$img = $cfgClient[$client]["upl"]["path"].$img;
		} else
		{
    		/* No, it's neither in the upload directory nor in the dbfs. return. */
    		return false;
    	}
	}
	
	$filename = $img;
	$filetype = substr($filename, strlen($filename) -4,4);
	
	$mxdAvImgEditingPosibility= checkImageEditingPosibility();
	switch ($mxdAvImgEditingPosibility)
	{
		case '1': // gd1
			$method = 'gd1';
			if (!function_exists('imagecreatefromgif') && $filetype == '.gif') 
			{
				$method = 'failure';
			}
			break;
		case '2': //gd2
			$method = 'gd2';
			if (!function_exists('imagecreatefromgif') && $filetype == '.gif') 
			{
				$method = 'failure';
			}
			break;
		case 'im': //imagemagick
			$method = 'im';
			break;
		case '0':
			$method = 'failure';
			break;
		default:
			$method = 'failure';
			break;
	}
	
	switch ($method)
	{
		case 'gd1':
			$return = capiImgScaleLQ($img, $maxX, $maxY, $crop, $expand, $cacheTime);	
			break;
		
		case 'gd2':
			$return = capiImgScaleHQ($img, $maxX, $maxY, $crop, $expand, $cacheTime);
			break;
		
		case 'im':
			$return = capiImgScaleImageMagick($img, $maxX, $maxY, $crop, $expand, $cacheTime);
			break;
		
		case 'failure':
        	$return = str_replace($cfgClient[$client]["path"]["frontend"], $cfgClient[$client]["path"]["htmlpath"], $img);
			break;
	}
	
	if ($deleteAfter == true)
	{
		unlink($img);
	}
	
	return $return;
					
}

/**
* check possible image editing functionality
*
* return mixed information about installed image editing extensions/tools
*/
function checkImageEditingPosibility() {

	if (isImageMagickAvailable())
	{
		return 'im';
	} else
	{
		if (extension_loaded('gd'))
		{
			if (function_exists('gd_info'))
			{
				$arrGDInformations = gd_info();
			
				if (preg_match('#([0-9\.])+#', $arrGDInformations['GD Version'], $strGDVersion))
				{
					if ($strGDVersion[0] >= '2')
					{
						return '2';
					}
					return '1';
				}
				return '1';
			}
			return '1';
		}
		return '0';
	}
}

?>

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » So 2. Dez 2007, 14:53

Ich habe die entsprechenden Datein unter den jeweiligen Ordner eingefügt
/var/www/html/contenido/cms/
Dann habe ich die Lightbox.css unter die "normale" style.css kopiert

und die Dateien

Code: Alles auswählen

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
in den Header der Layouts/Standart

Alsdann habe ich ein Modul Lightbox angelegt und in die Beschreibung den Text, in die Eingabe den Text (die auch GRÜN ist) und in die Ausgabe den Text...die abber leider rot ist...Das bedeutet doch das im Script der Ausgabe was nicht stimmt....Kann das was mit der Ordnerstruktur auf dem Server zutun haben - sprich: Erfindet einfach die entsprechenden Scripte nicht auf dem Server? Es hätte ja niemend ein Modul entwickelt was gleich auf "rot" schaltet wenn man es einfügt....

Ich verzweifel hier noch....

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » So 2. Dez 2007, 21:30

Meinen Verdacht verfestigt sich, wenn ich die Seiten-Suche verwende wird oben über den Header folgendes ausgegeben:

Code: Alles auswählen

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/virtual/site281/fst/var/www/html/contenido/cms/front_content.php(884) : eval()'d code on line 191

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/virtual/site281/fst/var/www/html/contenido/cms/front_content.php(884) : eval()'d code on line 191

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/virtual/site281/fst/var/www/html/contenido/cms/front_content.php(884) : eval()'d code on line 367
ob das im Zusammenhang steht?

Der Server ist auch nicht richtig gerootet zu da ich nach dem cms immer erst /front_content.php eingeben muss bevor ich das Frontend sehe...
Ich suche mir schon nen Wolf wo ich das einstellen kann - ist kein Confixx server....

Dat is alle wat....

Hilfäääääää!!!!!

wosch

Beitrag von wosch » So 2. Dez 2007, 21:57

cubig hat geschrieben:ob das im Zusammenhang steht?
Vermutlich.

Starte mal die Forums-Suche,
mit dem String: Call-time pass-by-reference has been deprecated

In deinem Code steh z. B. genau das was "bemängelt" wird:

Code: Alles auswählen

if( $media_name != "" && $link_description != "") 
...  
  if (($iCurrentPage < $iPages) && $iCurrentPage)

...

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » Mo 3. Dez 2007, 00:37

F**k - ich habe im Output Modul die beiden "&" gekillt (hat zwei Fehler abgestellt)
Zusätzlich die php.ini auf allow_call_time_pass_reference = true gestellt und trotzdem

Code: Alles auswählen

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/virtual/site281/fst/var/www/html/contenido/cms/front_content.php(884) : eval()'d code on line 191
@wosch

Wenn ich Deine Aussage richtig interpretiere sollte ich im Output der Lightbox die "&" löschen?

Was für ein Mist wenn man keinen Plan hat....

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Beitrag von cubig » Sa 8. Dez 2007, 18:05

Ich habe die php.ini geändert - Server neu gestartet - alles.
Fehlermeldung beim Suchen ist auch weg, aber
die Ausgabe meines Lightbox Modul bleibt rot und meine Fehlermeldung im Frontend bleibt:

Code: Alles auswählen

Parse error: parse error, unexpected T_STRING in /home/virtual/site281/fst/var/www/html/contenido/cms/front_content.php(884) : eval()'d code on line 296
Ordnerrechte?

Ich weiss nicht mehr weiter und gebe auf...

Dann klatsche ich die Bilder halt so rein...

cubig
Beiträge: 49
Registriert: Fr 2. Apr 2004, 09:28
Kontaktdaten:

Heureka

Beitrag von cubig » Mo 10. Dez 2007, 21:58

Ich weiss nicht wieso - aber alles nochmal neu - und siehe da - es funzt!

Nun habe ich nur noch ein Pfad Problem zu lösen und dann is feddich...

THX to all :D

borcherta
Beiträge: 36
Registriert: Sa 1. Dez 2007, 11:06
Kontaktdaten:

Beitrag von borcherta » Do 27. Dez 2007, 22:28

Hallo!

Wo kann ich eigentlich die zwei Bildbeschreibungen untern den thumps verändern, oder überhaupt einblenden lassen ??
Bei mir wird nur die Bildbeschreibung angezeigt ........ :?:

Seili
Beiträge: 21
Registriert: Di 15. Mär 2005, 16:47
Wohnort: Osnabrück
Kontaktdaten:

Beitrag von Seili » Di 8. Jan 2008, 12:49

Hallo Leute,

hier habe ich genau das Modul gefunden, welches ich für meine Galerie gesucht habe! Daumen hoch!

Funktioniert im prinzip auch genau so wie gewünscht, bis auf 2 "Kleinigkeiten"

Gibt es mittelerweile eine Erweiterung die die Seitenzahlen in der Übersicht ausgibt, wenn die Thumbs auf mehere Seiten verteilt sind?

Dann habe ich noch ein Problem, formatiere ich die Übersichtsgalerie im Backend zB. auf 5 spalten und 3 Zeilen, so werden die auf der ersten Seite korrekt angezeigt mit vernünftigen Abständen zwischen den Bildern usw.

Siehe hier:

Bild

sind allerdings nicht mehr genuegend Bilder vorhanden um die Tabelle komplett zu füllen erfolgt die Ausgabe so:

Bild

verschluckt das Script da irgendwelche Platzhalter?

Danke schonmal und Gruß!
Markus

Gesperrt