implement support for vertical scrolling (fixes #46)
This commit is contained in:
		
							parent
							
								
									c99d72ff55
								
							
						
					
					
						commit
						22ad44f0a8
					
				
					 2 changed files with 25 additions and 20 deletions
				
			
		|  | @ -6,7 +6,7 @@ | |||
|  * @author Jan Dittberner <jan@dittberner.info> | ||||
|  * @version \$Id$ | ||||
|  * | ||||
|  * Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info> | ||||
|  * Copyright (c) 2007, 2008, 2009 Jan Dittberner <jan@dittberner.info> | ||||
|  * 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)); | ||||
|  |  | |||
|  | @ -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" | ||||
|  |  | |||
		Reference in a new issue