Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ApacheGallery] problems with non-jpg images



There is a problem in current release with non-jpg image filename, as cached version use a specific naming scheme the main handler is unable to use. As a consequence, they are never created.

The following patch use a uniform naming scheme for all kind of images, fixing this issue.
--
Why is it when two planes almost hit each other it is called a "near miss"? Shouldn't it be called a "near hit"?
		-- Why Why Why n°43
--- lib/Apache/Gallery.pm~	2005-01-26 13:55:21.247919423 +0100
+++ lib/Apache/Gallery.pm	2005-01-26 13:57:16.582269928 +0100
@@ -127,6 +127,7 @@
 		my $image_height = $2;
 
 		$filename =~ s/\/(\d+)x(\d+)\-//;
+		$filename =~ s/\.jpg$//;
 
 		my ($width, $height, $type) = imgsize($filename);
 
@@ -859,15 +860,8 @@
 
 	my @dirs = split(/\//, $fullpath);
 	my $filename = pop(@dirs);
-	my $newfilename;
 
-	if (grep $type eq $_, qw(PPM TIF GIF)) {
-		$newfilename = $width."x".$height."-".$filename;
-		# needs to be configurable
-		$newfilename =~ s/\.(\w+)$/-$1\.jpg/;
-	} else {
-		$newfilename = $width."x".$height."-".$filename;
-	}
+	my $newfilename = $width."x".$height."-".$filename.".jpg";
 
 	return $newfilename;