diff --git a/includes/galleryfunctions.php b/includes/galleryfunctions.php index 32179c5..d0f7bc8 100644 --- a/includes/galleryfunctions.php +++ b/includes/galleryfunctions.php @@ -6,7 +6,7 @@ * @author Jan Dittberner * @version \$Id$ * - * Copyright (c) 2007, 2008 Jan Dittberner + * Copyright (c) 2007, 2008, 2009 Jan Dittberner * Jan Dittberner IT-Consulting & -Solutions, * Cottbuser Str. 1, D-01129 Dresden * @@ -54,16 +54,6 @@ if (array_key_exists('theme', $_GET) && $theme = new Theme($configuration['defaulttheme']); } -/** - * Breite der Vorschaubilder. - */ -$previewwidth = $theme->previewsize; - -/** - * Höhe der Thumbnailbilder. - */ -$thumbheight = $theme->thumbsize; - /** * Prüft, ob eine Galerie mit dem übergebenen Namen existiert. * @@ -117,13 +107,15 @@ function getGalleryConfig($galleryname = null) { * @li @a full relative URL des Vollbildes */ function getImageInfo($galleryname, $imagename) { + global $theme; + $label = getImageLabel($galleryname, $imagename); $gallerylabel = getGalleryLabel($galleryname); return array("name" => $imagename, "label" => $label, "preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR . getScaledImage($galleryname, $imagename, - $GLOBALS["previewwidth"], false), + $theme->previewsize, false), "full" => GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname . DIRECTORY_SEPARATOR . $imagename, "title" => sprintf("%s :: %s", $gallerylabel, $label) @@ -286,22 +278,33 @@ function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) { * und dem Ergebnis von getimagesize() als Werten ist. */ function getThumbNailInfo($galleryname) { + global $theme; + $thumbsizes = array(); - $thumbwidthsum = 2; + $thumbdimsum = 2; foreach (glob(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname) . DIRECTORY_SEPARATOR . '*.jp{e,}g', GLOB_BRACE) as $filename) { $basename = basename($filename); - $thumbfile = getScaledImage($galleryname, $basename, - $GLOBALS["thumbheight"]); + if ($theme->themetype == 'horizontal') { + $thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize, + true); + } else { + $thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize, + false); + } if ($thumbsize = getimagesize(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $thumbfile))) { $thumbsizes[$basename] = array($thumbfile, $thumbsize); - $thumbwidthsum = $thumbwidthsum + $thumbsize[0] + 3; + if ($theme->themetype == 'horizontal') { + $thumbdimsum = $thumbdimsum + $thumbsize[0] + 3; + } else { + $thumbdimsum = $thumbdimsum + $thumbsize[1] + 3; + } } } - return array($thumbwidthsum, $galleryname, $thumbsizes); + return array($thumbdimsum, $galleryname, $thumbsizes); } /** @@ -370,6 +373,8 @@ function getAllThumbnails(&$thumbinfo) { * @see getThumbNailInfo() */ function getFirstPreview(&$thumbinfo) { + global $theme; + reset($thumbinfo[2]); $basename = key($thumbinfo[2]); $data = current($thumbinfo[2]); @@ -377,7 +382,7 @@ function getFirstPreview(&$thumbinfo) { $fullname = GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname . DIRECTORY_SEPARATOR . $basename; $scaledimage = getScaledImage($galleryname, $basename, - $GLOBALS["previewwidth"], false); + $theme->previewsize, false); $scaledimagesize = getimagesize(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $scaledimage)); diff --git a/scripts/ourhandlers.js b/scripts/ourhandlers.js index 19bc811..f3f00f1 100644 --- a/scripts/ourhandlers.js +++ b/scripts/ourhandlers.js @@ -74,7 +74,7 @@ $(document).ready(function() { $("#scrollable").stop(); }); $("#arrright").mouseover(function() { - offset = parseInt($("#imgscroller").css("width")) - + var offset = parseInt($("#imgscroller").css("width")) - parseInt($("#scrollable").css("width")); $("#scrollable").animate({ left: offset + "px" @@ -91,7 +91,7 @@ $(document).ready(function() { $('#scrollable').stop(); }); $('#arrdown').mouseover(function() { - offset = parseInt($('#imgscroller').css('height')) - + var offset = parseInt($('#imgscroller').css('height')) - parseInt($('#scrollable').css('height')); $('#scrollable').animate({ top: offset + "px"