Index: qdig.php
===================================================================
RCS file: /home/matt/.cvsroot/www/wronka/pictures/qdig.php,v
retrieving revision 1.28
diff -u -r1.28 qdig.php
--- qdig.php	4 Jan 2006 08:55:50 -0000	1.28
+++ qdig.php	1 Apr 2006 22:42:48 -0000
@@ -16,7 +16,7 @@
 | for customizing your galleries.  The script runs stand-alone, or a
 | gallery may be included within another page.  Enjoy!
 +----------------------------------------------------------------------+
-| Portions Copyright 2005 Matthew Wronka <qdig@nonce.matt.wronka.org>
+| Portions Copyright 2005, 2006 Matthew Wronka <qdig@nonce.matt.wronka.org>
 | *   Any support questions with this script should be sent to Matt!   *
 | * Please do not ask Hagan or use the forums for the original script. *
 | Original script by Hagan Fox <http://qdig.sourceforge.net/>
@@ -37,9 +37,9 @@
 | Version 2 along with this program; if not, visit GNU's Home Page
 | http://www.gnu.org/
 +----------------------------------------------------------------------+
-CVS: $Id: qdig.php,v 1.28 2006/01/04 08:55:50 matt Exp $#
+CVS: $Id: qdig.php,v 1.32 2006/02/02 22:16:35 matt Exp $#
 */#
-$qdig_version = '20051203cnj [based on 20050509]';
+$qdig_version = '20060105cnj+ [based on 20050509]';
 $mtime = microtime();
 $mtime = explode(' ', $mtime);
 $start_time = $mtime[1] + $mtime[0];
@@ -67,7 +67,7 @@
 * If this is set, the text will appear at the bottom of your gallery.
 * See http://www.whatiscopyright.org/ for information about copyrights.
 */
-$copyright['txt'] = 'Images copyright &copy; 2003, 2004, 2005 original creators or assignees. All rights reserved.';#
+$copyright['txt'] = 'Images copyright &copy; 2003, 2004, 2005, 2006 original creators or assignees. All rights reserved.';#
 $copyright['txt'] = '<a href="http://matt.wronka.org/site/about/#copyright_pictures">'.$copyright['txt'].'</a>';
 
 /**
@@ -111,7 +111,9 @@
 */
 $dir_nav['enable']    = TRUE;  // Enable Directory Navigation.  If disabled,
                                // subdirectories will be isolated galleries.
-$dir_nav['small']     = FALSE; // Use small text for Dir. Navigation row.
+// XXX TODO fix this
+$dir_nav['above']     = TRUE; // Above (TRUE), or Below (FALSE or 2, which is both)
+$dir_nav['small']     = TRUE; // Use small text for Dir. Navigation row.
 $dir_nav['fname_ena'] = FALSE; // Display the filename.
 $dir_nav['cntr_ena']  = TRUE;  // Display the counter.
 $dir_nav['path_delim'] = '&gt;'; // Delimiter between path elements
@@ -154,7 +156,7 @@
 */
 $thumbs['enable']   = TRUE;  // Enable thumbs view.  Safe to leave TRUE.
 $thumbs['default']  = TRUE;  // Default to thumbs view if thumbs-capable.
-$thumbs['onfly']    = TRUE;  // Create thumbnails 'on the fly' in their
+$thumbs['onfly']    = FALSE;  // Create thumbnails 'on the fly' in their
                              // own request so pages load more quickly.
 // Wrapping -- Don't wrap only one or two thumbnails.
 $thmb_row['maxwidth'] = 680; // Approx. max. width of thumbnails row
@@ -216,8 +218,8 @@
 $exif_camera['enable'] = TRUE;	// Show a line mentioning camera and settings.
 $exif_camera['min_width'] = 300;
 $exif_camera['padding'] = '3px';
-$exif_camera['above'] = TRUE;	// Place camera line above the image, not below.
-$exif_verbose['enable'] = TRUE;	// Show verbose EXtendedInFormation on the side
+$exif_camera['above'] = FALSE;	// Place camera line above the image, not below.
+$exif_verbose['enable'] = FALSE;	// Show verbose EXchangeable image file information on the side
 //$exif_verbose['min_width'] = 300;	/// XXX these need to change
 //$exif_verbose['padding'] = '3px';
 $exif_verbose['above'] = FALSE;	// Plase verbose above image, not below
@@ -261,7 +263,7 @@
 $img_link['th_page'] = FALSE; // NEW! Link to all-thumbs view if available... // TODO Rename?
 $img_link['t_p_few'] = FALSE; // NEW! ...even in directories with few images. // TODO better description
 // Other scripts have the following, so some people must like it.
-$img_link['full']  = TRUE; // If the image is a resized version, link to the
+$img_link['full']  = FALSE; // If the image is a resized version, link to the
                             // full sized version.  Disables 'next' and 'wrap'.
 $img_link['file']  = TRUE; // Full size link goes directly to the image file.
 
@@ -616,6 +618,7 @@
 /**
 * Path Settings  (Override defaults.)
 */
+$qdig_url_alias='gallery/';	// if set, will use this.'/$Qwd/$Qif'
 $qdig_url = '/pictures/'; // Self-referring URL path.  Examples: '/photos/' or
                 // '/photos/qdig.php' or '/~someuser/qdig/index.php'
 // The next two are the same location; as a URL and as a filesystem path.
@@ -630,6 +633,7 @@
 $excl_dirs[] = 'Private';        // | Ignore a directory with its name
 $excl_dirs[] = 'qdig-converted'; // | included here.  Do not  end these
 $excl_dirs[] = 'CVS';               // | name(s) with '/'.
+$excl_dirs[] = 'qdig-files';               // 
 $excl_dirs[] = '';               // 
 $excl_imgs[] = 'qdig-bg.jpg'; // | Ignore any image with its name
 $excl_imgs[] = 'favicon.png'; // | included here.  Add as many of
@@ -640,7 +644,7 @@
                       // Examples: 'incl=qdig.php&amp;' 'a=foo&amp;b=bar&amp;'
 $keep_params = FALSE; // Retain extra GET parameters in Qdig URLs.  Allows
                       // Qdig to "share" the query string when embedded. // TODO: Set limits (#/size)? Rename?
-$anchor = '';         // Include an intra-page anchor in URLs.  For embedded
+$anchor = '#qdig-dirnav';         // Include an intra-page anchor in URLs.  For embedded
                       // galleries, use '#qdig' to jump down to the gallery.
 
 /**
@@ -1538,7 +1542,8 @@
 function dirnavPath($dir_nav, $thm_dir_view = FALSE)
 {
 	global $get_vars, $imgs, $subdirs, $qdig_url, $extra_param, $anchor,
-		$reqd_image, $img_link, $dir_nav, $rootdir, $thmb_row, $cnvrt_thmb;
+		$reqd_image, $img_link, $dir_nav, $rootdir, $thmb_row, 
+		$cnvrt_thmb, $qdig_url_alias;
 	$i = 0;
 	$num_imgs = count($imgs);
 	$split_path = explode('/', urlPath($reqd_image['pwd']));
@@ -1646,7 +1651,9 @@
 */
 function getDirectoryImage($root, $bThmb=false)
 {
-	global $url_base_path, $pwd, $cnvrt_files_root, $cnvrtd_dir, $cnvrt_thmb;
+	global $url_base_path, $pwd, $cnvrtd_files_root, $cnvrtd_dir, $cnvrt_thmb;
+	global $qdig_files, $convrtd_subdir;
+
 	$dirs=array('');
 	while(sizeof($dirs)) {
 		shuffle($dirs);
@@ -1654,10 +1661,24 @@
 			$dir_imgs = getImageFilenames($root.'/'.$dir);
 			$rval = $dir_imgs[rand(0,sizeof($dir_imgs)-1)];
 			if($rval!='') {
-				if(!$bThmb) return $rval;
-				$dcnvrt_path   = cleanPath($cnvrtd_files_root.$root.'/'.$dir.'/'.$cnvrtd_dir);
-				$thmb_file = $url_base_path.'/'.$dcnvrt_path.'/'.'/'.$cnvrt_thmb['prefix'].$rval.'.jpeg';
-				return $thmb_file;
+				if(!$bThmb) {
+					$img_size = GetImageSize($rval);
+				} else {
+	/* XXX TODO: major entire code-base cleanup of cnvrtd_path stuff */
+		/* Make stuff work, cleanly, with qdig-files.  This works, not clean. */
+					if(!isset($qdig_files) || !$qdig_files) {
+						$dcnvrt_path   = cleanPath($cnvrtd_files_root.$root.'/'.$dir.'/'.$cnvrtd_dir);
+					} else {
+						$dcnvrt_path   = cleanPath($cnvrtd_files_root.$qdig_files.'/'.$convrtd_subdir.'/'.$root.'/'.$dir.'/'.$cnvrtd_dir);
+					}
+					$thmb_file = $fs_base_path.$dcnvrt_path.'/'.'/'.$cnvrt_thmb['prefix'].$rval.'.jpeg';
+					$thmb_path = $url_base_path.'/'.$dcnvrt_path.'/'.'/'.$cnvrt_thmb['prefix'].$rval.'.jpeg';
+					$rval = $thmb_path;
+					$img_size = GetImageSize($thmb_file);
+				}
+				$width = $img_size[0];
+				$height = $img_size[1];
+				return array($rval, $width, $height);
 			}
 		}
 		$root=$root.'/'.$dirs[0];
@@ -1717,7 +1738,10 @@
 			$rimg='';
 			if ($dir_nav['icon'] == 2 && !isset($imgs)) {
 				$rand_image = getDirectoryImage("{$reqd_image['pwd']}/$dir", True);
-				$rimg = '<img src="'.$rand_image.'" alt="Gallery Image" style="vertical-align:middle" />&nbsp;';
+				$rimg = '<img src="'.$rand_image[0].'" width="'
+					.$rand_image[1].'" height="'
+					.$rand_image[2]
+					.'" alt="Gallery Image" style="vertical-align:middle" />&nbsp;';
 				if($rand_image=='') $rimg='';
 			}
 			$str .= <<<EOT
@@ -2491,7 +2515,7 @@
 } // End exifCameraBlock()
 
 /**
-* Display all(?) EXtended InFormation (in TIFFs and JPEGs)
+* Display all(?) EXchangeable image file information (in TIFFs and JPEGs)
 *
 * The block is as wide as the image or else $exif_verbose['min_width'] pixels.
 */
@@ -3906,7 +3930,7 @@
 */
 if ($thumbs['onfly'] == FALSE &&
    !(isset($GLOBALS['no_qdig_body']) &&  $GLOBALS['no_qdig_body'])) {
-	$thumbs_msg = createThumbs($cnvrt_thmb, fale);
+	$thumbs_msg = createThumbs($cnvrt_thmb, false);
 	$thumbs_msg = createThumbs($cnvrt_thmb_rv, true);
 }
 
@@ -4100,8 +4124,10 @@
 /**
 * Directory Navigation
 */
-$dirnav_out = dirNav($dir_nav);
-echo $dirnav_out['str'];
+if($dir_nav['above']) {
+	$dirnav_out = dirNav($dir_nav);
+	echo $dirnav_out['str'];
+}
 
 /**
 * Control Bar
@@ -4214,6 +4240,7 @@
 {
 	echo displayImageLinks($thmb_row, $nmrl_row);
 }
+
 echo "<div class='qdig-dirfooter'>$dirfoot</div>\n";
 
 // Gallery Footer Row (site link / copyright / qdig home link)
