--- Gallery.pm.orig	2005-11-04 23:24:52.000000000 -0500
+++ Gallery.pm	2005-11-04 23:36:18.000000000 -0500
@@ -384,7 +384,9 @@
 					my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate");
 					my %file_vars = (FILEURL => uri_escape($fileurl, $escape_rule),
 							 FILE    => $file,
-							 DATE    => $imageinfo->{DateTimeOriginal} ? $imageinfo->{DateTimeOriginal} : '', # should this really be a stat of the file instead of ''?
+							 DATE    => $imageinfo->{DateTimeOriginal} ? $imageinfo->{DateTimeOriginal} : $imageinfo->{FileDateTime},
+							 COMMENT => $imageinfo->{Comment} ? ext_multi_comments( $imageinfo ) : '',
+							 SIZE    => $imageinfo->{FileSize} ? $imageinfo->{FileSize} : '',
 							 SRC     => uri_escape($uri."/.cache/$cached", $escape_rule),
 							 HEIGHT => (grep($rotate==$_, (1, 3)) ? $thumbnailwidth : $thumbnailheight),
 							 WIDTH => (grep($rotate==$_, (1, 3)) ? $thumbnailheight : $thumbnailwidth),
@@ -619,6 +621,10 @@
 			$foundcomment = 1;
 			$tpl_vars{COMMENT} = $comment_ref->{COMMENT} . '<br>' if $comment_ref->{COMMENT};
 			$tpl_vars{TITLE} = $comment_ref->{TITLE} if $comment_ref->{TITLE};
+ 		} elsif ( $r->dir_config('GalleryUseHeaderComments') ) {
+ 		    my $comment = ext_multi_comments( $imageinfo );
+ 		    $foundcomment = $comment ne '';
+ 		    $tpl_vars{COMMENT} = $comment;
 		} else {
 			$tpl_vars{COMMENT} = '';
 		}
@@ -797,6 +803,20 @@
 
 }
 
+sub ext_multi_comments {
+    my ( $imageinfo ) = @_;
+
+    my $multi_comment = '';
+    if( exists $imageinfo->{'Comment'} ){
+	$multi_comment = $imageinfo->{'Comment'};
+	if( ref $multi_comment eq 'ARRAY' ){
+	    $multi_comment = join "<br>\n", @$multi_comment;
+	}
+    }
+    return $multi_comment;
+}
+
+
 sub cache_dir {
 
 	my ($r, $strip_filename) = @_;
@@ -1003,6 +1023,17 @@
 	return ($width, $height);
 }
 
+sub FilterSize{ # input: size returned by -s
+  my($size) = @_;
+  my @scale = ("Bytes","KB","MB","GB","TB","PB");
+  my $ord = 0;
+  if($size > 0){
+    $ord = int(log($size)/log(1024));
+  }
+  $size = sprintf("%.2f",$size/(1024 ** $ord));
+  return "$size ".$scale[$ord];
+}
+
 sub get_imageinfo {
 	my ($r, $file, $type, $width, $height) = @_;
 	my $imageinfo = {};
@@ -1028,6 +1059,11 @@
 		}
 	}
 
+	$imageinfo->{FileSize} = FilterSize( -s $file );
+
+	my $stat = stat( $file );
+	$imageinfo->{FileDateTime} = localtime( $stat->mtime );
+
 	unless (defined($imageinfo->{width}) and defined($imageinfo->{height})) {
 		$imageinfo->{width} = $width;
 		$imageinfo->{height} = $height;
@@ -1765,10 +1801,21 @@
 	And this is the comment.<br>
 	And this is line two of the comment.
 
+Comments can also be put inside the image itself. See
+B<GalleryUseHeaderComments>.
+
 The visible name of the folder is by default identical to the name of
 the folder, but can be changed by creating a file <directory>.folder
 with the visible name of the folder.
 
+=item B<GalleryUseHeaderComments>
+
+This will use the comments field of the image if there are any present. 
+Often times this is un-wanted, as programs like Photoshop like to put 
+"created by..." advertisements in that field.
+
+Set to 1 or 0, default is 0
+
 =back
 
 =head1 DEPENDENCIES
