1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-06 11:41:52 +00:00

Upgrade to 2.03pre2

This commit is contained in:
Andrey A. Chernov 2002-10-23 00:41:57 +00:00
parent 5231cac832
commit 5357480d6a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=68624
4 changed files with 87 additions and 755 deletions

View File

@ -6,12 +6,11 @@
#
PORTNAME= WebMagick
PORTVERSION= 2.03p1
PORTREVISION= 4
PORTVERSION= 2.03p2
CATEGORIES= www graphics
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= webmagick
DISTNAME= ${PORTNAME}-2.03pre1
DISTNAME= ${PORTNAME}-2.03pre2
MAINTAINER= ache@freebsd.org

View File

@ -1 +1 @@
MD5 (WebMagick-2.03pre1.tar.gz) = 7393a629fcbb6c70b2d9afe1fdb7feb7
MD5 (WebMagick-2.03pre2.tar.gz) = 1dcd48683ef2467beb7003637e2b7d53

View File

@ -1,743 +1,109 @@
Index: webmagick.in
===================================================================
RCS file: /cvsroot/webmagick/WebMagick/webmagick.in,v
retrieving revision 1.102
retrieving revision 1.112
diff -u -r1.102 -r1.112
--- webmagick.in 21 Aug 2002 20:36:28 -0000 1.102
+++ webmagick.in 7 Sep 2002 16:35:38 -0000 1.112
@@ -1,6 +1,6 @@
#! @PERL@
#
-# $Id: webmagick.in,v 1.102 2002/08/21 20:36:28 clindell Exp $
+# $Id: webmagick.in,v 1.112 2002/09/07 16:35:38 ache Exp $
#
# You are looking at the main PERL script for WebMagick, a package to
# intelligently create HTML and JavaScript index files and imagemaps
@@ -122,7 +122,6 @@
$opt_lowresformat,
$opt_lowresgeom,
$opt_lowresmin,
- $opt_lowresgeometry,
$opt_coloralink,
$opt_colorback,
$opt_colorfore,
@@ -302,7 +301,7 @@
$opt_serversidemap = 0; # Enable server-side maps writting
$perlVarsVersion = 0; # default this to 0 for it to be overidden by appropriate status files
-$requiredPerlVarsVersion = 2.2; # need this version to avoid regeneration of files
+$requiredPerlVarsVersion = 2.3; # need this version to avoid regeneration of files
#
# RC files
@@ -459,11 +458,10 @@
# this size will not be cached.
#PMF: I have added a low resolution of the pictures, by default 640x480
-$opt_lowresgeometry = '640x480+2+2>'; # Size of low resolution images (width x height)
$opt_lowres = 1; # Cache low resolution images
$opt_lowresdir = '.640x480'; # Subdirectory to cache low resolution images in
$opt_lowresformat = 'JPEG'; # Format to use for low resolution images
-$opt_lowresgeom = $opt_lowresgeometry; # Low Resolution Images geometry
+$opt_lowresgeom = '640x480+2+2>'; # Size of low resolution images (width x height)
$opt_lowresmin = 640*480; # Smallest image to cache in total pixels
# (width * height). Images smaller than
# this size will not be cached.
@@ -769,7 +767,6 @@
'lowresformat=s' => \$opt_lowresformat,
'lowresgeom=s' => \$opt_lowresgeom,
'lowresmin=i' => \$opt_lowresmin,
- 'lowresgeometry=s' => \$opt_lowresgeometry,
'coloralink=s' => \$opt_coloralink,
'colorback=s' => \$opt_colorback,
'colorfore=s' => \$opt_colorfore,
@@ -1214,6 +1211,8 @@
# close LOCKFILE;
#}
+ # XXX: lowres implemented for javascript only
+ $opt_lowres = 0 if !$opt_javascript;
$currentDate = strftime ($opt_msg_date_format, localtime);
@@ -1596,8 +1595,8 @@
--- webmagick.orig Wed Oct 23 03:50:49 2002
+++ webmagick.in Wed Oct 23 04:25:13 2002
@@ -1595,9 +1595,6 @@
'address' => $opt_address,
'anonymous' => $opt_anonymous,
'backgroundimg' => $opt_icons{'background'},
- 'cachedir' => $opt_cachedir,
- 'lowresdir' => $opt_lowresdir,
+ 'cachedir' => !$opt_tables ? "" : $opt_cachedir,
+ 'cacheformat' => !$opt_tables ? "" : $opt_cacheformat,
- 'lowres' => $opt_lowres,
- 'lowresdir' => !$opt_lowres ? "" : $opt_lowresdir,
- 'lowresformat' => !$opt_lowres ? "" : $opt_lowresformat,
'cachedir' => !$opt_tables ? "" : $opt_cachedir,
'cacheformat' => !$opt_tables ? "" : $opt_cacheformat,
'coloralink' => $opt_coloralink,
'colorback' => $opt_colorback,
'colorfore' => $opt_colorfore,
@@ -1675,7 +1674,7 @@
'subdirectories' => !$opt_frames ? "" : join(' ',@dirNames),
'tables' => $opt_tables,
'title' => $pageTitle,
- 'version' => $webmagickInfo{'version'},
+ 'version' => $opt_anonymous ? "" : $webmagickInfo{'version'},
);
# Compute a conglomeration of all parameters that effect the HTML
@@ -1903,38 +1902,40 @@
#
# Clean up cached thumbnails
#
- if( $opt_cache && -d $opt_cachedir ) {
+ if( ($opt_cache || $opt_tables) && -d $opt_cachedir ) {
+ my @extra;
+ my %tarray;
+
opendir( CACHEDIR, "$opt_cachedir")
|| die("$0: Failed to open directory $opt_cachedir\n$@\n");
@cacheFiles = grep(!/$excludeRegex/io,readdir( CACHEDIR ));
closedir( CACHEDIR );
- }
- {
- my @extra;
- my %tarray;
- grep( $tarray{$_}++, @imgfiles );
+ grep( $tarray{"$_.\L${opt_cacheformat}"}++, @imgfiles );
@extra = grep( $_ = "$opt_cachedir/$_", grep( ! $tarray{$_}, @cacheFiles ));
- print( STDERR "Removing extra cache files @extra\n") if $opt_debug;
- unlink( @extra );
+ if ($#extra >= 0) {
+ print( STDERR "Removing extra cache files @extra\n") if $opt_debug;
+ unlink( @extra );
+ }
}
#
# Clean up cached low resolution images
#
if( $opt_lowres && -d $opt_lowresdir ) {
+ my @extra;
+ my %tarray;
+
opendir( LOWRESDIR, "$opt_lowresdir")
|| die("$0: Failed to open directory $opt_lowresdir\n$@\n");
@lowresFiles = grep(!/$excludeRegex/io,readdir( LOWRESDIR ));
closedir( LOWRESDIR );
- }
- {
- my @extra;
- my %tarray;
- grep( $tarray{$_}++, @imgfiles );
+ grep( $tarray{"$_.\L${opt_lowresformat}"}++, @imgfiles );
@extra = grep( $_ = "$opt_lowresdir/$_", grep( ! $tarray{$_}, @lowresFiles ));
- print( STDERR "Removing extra lowres files @extra\n") if $opt_debug;
- unlink( @extra );
+ if ($#extra >= 0) {
+ print( STDERR "Removing extra lowres files @extra\n") if $opt_debug;
+ unlink( @extra );
+ }
}
#
@@ -2597,7 +2598,7 @@
# TODO: make sure the thumbnails are created, and get some image sizes
# TODO: save the labels in a new array, maybe same with sizes
if ( $thumbImageSizes{$pic}) {
- print (INDEX "<IMG SRC=\"", $opt_cachedir, "/", escapeurl($pic), "\" $thumbImageSizes{$pic} BORDER=0>");
+ print (INDEX "<IMG SRC=\"", $opt_cachedir, "/", escapeurl($pic), ".\L${opt_cacheformat}", "\" $thumbImageSizes{$pic} BORDER=0>");
} else {
print (INDEX "<IMG SRC=\"", escapeurl($pic), "\" BORDER=0>");
}
@@ -2889,12 +2890,12 @@
#
# If caching thumbnails then ensure that directory exists
#
- mkdir( $opt_cachedir, 0755 ) if ! -d $opt_cachedir;
+ mkdir( $opt_cachedir, 0755 ) if ($opt_cache || $opt_tables) && ! -d $opt_cachedir;
#
# If caching low resolution images then ensure that directory exists
#
- mkdir( $opt_lowresdir, 0755 ) if ! -d $opt_lowresdir;
+ mkdir( $opt_lowresdir, 0755 ) if $opt_lowres && ! -d $opt_lowresdir;
# Read images into PerlMagick object
print( STDERR "\nReading images: ", join(' ', @{$imageNames[$pageNumber - 1]}), "\n" )
@@ -2919,217 +2920,37 @@
READ:
foreach $imagename (@{$imageNames[$pageNumber - 1]}) {
- my ($rc, #return code
- $width, # Image width
- $height, # Image height
- $filesize, # Image file size
- $magick);
+ my ($rc, #return code
+ $width, # Image width
+ $height, # Image height
+ $filesize, # Image file size
+ $magick);
+ if ($opt_lowres) {
#PMF: resize images using createLowResolutionImage()
#first do the low resolution image
- ($rc, $filesize, $width, $height, $magick) =
- &createLowResolutionImage ($image, $opt_lowresdir, $imagename, 0, $opt_lowres, 0,
- $opt_forcelowres, $opt_lowresgeometry,
- $opt_lowresformat, $opt_lowresmin,
- 0, 0);
+ ($rc, $filesize, $width, $height, $magick) =
+ &createLowResolutionImage ($image, $opt_lowresdir, $imagename, 0, 1, 0,
+ $opt_forcelowres, $opt_lowresgeom,
+ $opt_lowresformat, $opt_lowresmin,
+ 0, 0);
@@ -1636,6 +1633,9 @@
'jsfunctions' => !$opt_javascript ? "" : $fileNames{'jsFunctions'},
'jspageindex' => !$opt_javascript ? "" : $fileNames{'jsPageIndex'},
'jsvariables' => !$opt_javascript ? "" : $fileNames{'jsVariables'},
+ 'lowres' => $opt_lowres,
+ 'lowresdir' => !$opt_lowres ? "" : $opt_lowresdir,
+ 'lowresformat' => !$opt_lowres ? "" : $opt_lowresformat,
'metaauthor' => $opt_metaauthor,
'metacharset' => $opt_metacharset,
'metaclassification' => $opt_metaclassification,
@@ -2938,6 +2938,8 @@
$opt_lowresformat, $opt_lowresmin,
0, 0);
if ($rc == -1) {
- next READ;
+ next READ;
+ # @$image already deleted
+ print("Trying next image...\n");
next READ;
}
undef @$image; # Only delete image data, not object
+ }
- #then do the thumbnail
- ($rc, $filesize, $width, $height, $magick) =
- &createLowResolutionImage ($image, $opt_cachedir, $imagename, $opt_cache, 0, $opt_tables,
- $opt_forcecache, $opt_thumbgeometry,
- $opt_cacheformat, $opt_cachemin,
- $opt_thumbprehook, $opt_thumbposthook);
- if ($rc == -1) {
@@ -2951,7 +2953,9 @@
$opt_cacheformat, $opt_cachemin,
$opt_thumbprehook, $opt_thumbposthook);
if ($rc == -1) {
- next READ;
- }
-
-#PMF: moved to createLowResolutionImage()
-# my (
-# $width, # Image width
-# $height, # Image height
-# $base_columns, # Original width
-# $base_rows, # Original height
-# $class, # Image class
-# $comment, # Image comment
-# $depth, # Image color depth
-# $filesize, # Image file size
-# $magick, # Image magick
-# );
-# #
-# # Handle thumbnail cache
-# #
-# my $cachename = "$opt_cachedir/$imagename";
-
-# $newthumb = 1; # Start presuming that thumbnail is new
-# # If we are caching, and cache thumbnail exists and is newer then use it
-# # always make cache if doing tables, or if version is not correct
-# if ( ($opt_cache || $opt_tables) && ! $opt_forcecache && -f $cachename
-# && (fmtime($cachename) >= fmtime($imagename))) {
-# # Read image
-# print( STDERR "Reading $cachename ...\n" ) if $opt_debug;
-# $status = $image->Read("$cachename");
-# if("$status") {
-# undef @$image; # Only delete image data, not object
-# handleMagickError( __FILE__, __LINE__, $cachename, $status);
-# next READ; # Try to read next image
-# }
-
-# # Obtain original image parameters
-# $comment = $image->Get("comment");
-# if ($comment =~
-# # xv 3.00 & 3.10 format
-# /IMGINFO:(\d+)x(\d+) (\S+) file\s+\((\d+) bytes\)/ ) {
-# $width = $1;
-# $height = $2;
-# $magick = $3;
-# $filesize = $4;
-# } else {
-# print( STDERR "Failed to grock image info from thumbnail ${cachename}!\n",
-# "Removing cache file ...\n" );
-# print( STDERR "Run WebMagick again to re-generate the thumbnail.\n" );
-# print( STDERR "If problem continues then your ImageMagick is out of date.\n" );
-# unlink( $cachename );
-# }
-
-# # Indicate that thumbnail came from cache
-# $newthumb = 0;
-# } else {
-# # Otherwise, read and scale image
-
-# # Set desired image read size. The JPEG library will
-# # read and return a reduced image which is at least
-# # the size specified (it returns a number of standard
-# # scaled sizes) but not smaller.
-# # This uses a feature available in PerlMagick 1.12 and beyond
-# $status = $image->Set(size=>$opt_thumbgeometry);
-# handleMagickError( __FILE__, __LINE__, "$opt_thumbgeometry", $status) if "$status";
-
-# # Read image
-# print( STDERR "Reading ${imagename}\[0\] ...\n" ) if $opt_debug;
-# $status = $image->Read("${imagename}\[0\]");
-# if("$status" && handleMagickError( __FILE__, __LINE__, $imagename, $status)) {
-# undef @$image; # Only delete image data, not object
-# print("Trying next image ...\n" );
-# next READ; # Try to read next image }
-# }
-
-# # Scale image and obtain original parameters if not from cache
-# if( $newthumb ) {
-
-# #
-# # Apply any PerlMagick operations specified by $opt_thumbprehook
-# #
-# if( $opt_thumbprehook ) {
-# print("Evaluating thumbnail pre-hook ...\n$opt_thumbprehook\n" )
-# if $opt_debug;
-# eval $opt_thumbprehook;
-# }
-
-# # Obtain image parameters
-# ( $width, $height, $filesize, $magick, $class, $depth ) =
-# $image->Get(
-# 'width',
-# 'height',
-# 'filesize',
-# 'magick',
-# 'class',
-# 'depth');
-
-# if( $opt_debug ) {
-# print("Image: ${width}x${height} $class $filesize bytes $magick $depth bits\n");
-# }
-
-# # Obtain original image size. This uses a feature
-# # available in PerlMagick 1.12 and beyond. If the
-# # feature is not supported then undefined values
-# # should be returned.
-# ($base_columns, $base_rows) = $image->Get('base-columns', 'base-rows');
-# if( defined($base_columns) && defined($base_rows) ) {
-# $width = $base_columns;
-# $height = $base_rows;
-# print("Saving original image size ${base_columns}x${base_rows}\n")
-# if $opt_debug;
-# }
-
-# my $geometry;
-# if( $opt_cache ) {
-# $geometry = $opt_cachegeom;
-# } else {
-# $geometry = $opt_thumbgeometry;
-# }
-
-# my $opt_sampling = 0; # Set to 1 to enable sampling
-# if( $class eq 'PseudoClass' && $opt_sampling ) {
-# print( STDERR "Sampling $imagename to geometry \"${geometry}>\" ...\n")
-# if $opt_debug;
-# $status = $image->Sample(geometry=>"${geometry}>");
-
-# } else {
-# print( STDERR "Zooming $imagename with geometry \"${geometry}>\" ...\n")
-# if $opt_debug;
-# $status = $image->Zoom(filter=>"${opt_zoomfilter}",
-# blur=>0.6,
-# geometry=>"${geometry}>" );
-# }
-
-# if("$status") {
-# undef @$image; # Only delete image data, not object
-# handleMagickError( __FILE__, __LINE__, $imagename, $status);
-# next READ; # Try to read next image
-# }
-# }
-
-# #
-# # Apply any PerlMagick operations specified by $opt_thumbposthook
-# #
-# if( $opt_thumbposthook ) {
-# print("Evaluating thumbnail post-hook ...\n$opt_thumbposthook\n" ) if $opt_debug;
-# eval $opt_thumbposthook;
-# }
-
-# # If we are caching, thumbnail is new, and image is
-# # large enough, then write it to thumbnail cache
-# # if we are using tables, then we cache as long as it's new
-# if( ($opt_cache || $opt_tables) && $newthumb && ((($width*$height) > $opt_cachemin) || $opt_tables)) {
-
-
-# my $comment="IMGINFO:${width}x${height} ${magick} file (${filesize} bytes)";
-# print( STDERR "Applying image comment:\n${comment}\n") if $opt_debug;
-
-# # Apply comment to thumbnail image
-# $status = $image->Comment( $comment );
-# handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
-
-# print( STDERR "Writing ${cachename} with format ${opt_cacheformat} ...\n" )
-# if $opt_debug;
-# #
-# # Give JPEG files special treatment
-# #
-# if( $opt_cacheformat eq 'JPEG' || $opt_cacheformat eq 'JPG' ) {
-# $status = $image->Write(
-# filename=>"${opt_cacheformat}:${cachename}",
-# interlace=>'None',
-# quality=>85
-# );
-# } else {
-# $status = $image->Write(
-# filename=>"${opt_cacheformat}:${cachename}"
-# );
-# }
-# handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
-# # TODO: for some reason, the output looks like these are getting put in twice, once with .cache/
-# $thumbImageSizes{$imagename} = html_imgsize($cachename);
-
-# }
-
-# }
+ #then do the thumbnail
+ ($rc, $filesize, $width, $height, $magick) =
+ &createLowResolutionImage ($image, $opt_cachedir, $imagename, $opt_cache, 0, $opt_tables,
+ $opt_forcecache, $opt_thumbgeometry,
+ $opt_cacheformat, $opt_cachemin,
+ $opt_thumbprehook, $opt_thumbposthook);
+ if ($rc == -1) {
+ # @$image already deleted
+ print("Trying next image...\n");
+ next READ;
+ }
}
-
#
# Add thumbnail to thumbs array
#
@@ -3205,9 +3026,6 @@
print( STDERR "Montage directory = $directory\n" ) if $opt_debug;
for (split(/\n/,$directory))
{
- # Eliminate cache dir from path HACK! HACK!
- s%$opt_cachedir/%% if $opt_cache;
- my $img = $_;
my $x1 = $x;
my $y1 = $y;
my $x2 = $x+$thumbWidth-1;
@@ -3215,7 +3033,6 @@
push(@thumbCoords, "$x1,$y1,$x2,$y2");
- #print " <area href=", escapeurl($_), " shape=rect coords=$x1,$y1,", $x2,',', $y2, ">\n";
$x+=$thumbWidth;
if ($x >= $montageWidth)
{
@@ -3845,29 +3662,29 @@
#returns 0 if everything went fine, -1 if the image does not exist
sub createLowResolutionImage () {
my ($image, $a_dir, $imagename, $a_cache, $a_lowres, $a_tables,
- $a_force, $a_geometry, $a_cacheformat, $a_cachemin,
- $a_prehook, $a_posthook) = @_;
+ $a_force, $a_geometry, $a_cacheformat, $a_cachemin,
+ $a_prehook, $a_posthook) = @_;
+
+ my (
+ $newthumb, # Set to 1 if new thumbnail
+ $status # Return status
+ );
my (
- $newthumb, # Set to 1 if new thumbnail
- $status # Return status
- );
-
- my (
- $width, # Image width
- $height, # Image height
- $base_columns, # Original width
- $base_rows, # Original height
- $class, # Image class
- $comment, # Image comment
- $depth, # Image color depth
- $filesize, # Image file size
- $magick, # Image magick
- );
+ $width, # Image width
+ $height, # Image height
+ $base_columns, # Original width
+ $base_rows, # Original height
+ $class, # Image class
+ $comment, # Image comment
+ $depth, # Image color depth
+ $filesize, # Image file size
+ $magick # Image magick
+ );
#
# Handle thumbnail/lowres cache
#
- my $cachename = "$a_dir/$imagename";
+ my $cachename = "${a_dir}/${imagename}.\L${a_cacheformat}";
$newthumb = 1; # Start presuming that thumbnail is new
# If we are caching, and cache thumbnail exists and is newer then use it
@@ -3914,8 +3731,8 @@
handleMagickError( __FILE__, __LINE__, "$a_geometry", $status) if "$status";
@@ -3731,14 +3735,18 @@
# scaled sizes) but not smaller.
# This uses a feature available in PerlMagick 1.12 and beyond
$status = $image->Set(size=>$a_geometry);
- handleMagickError( __FILE__, __LINE__, "$a_geometry", $status) if "$status";
+ if ("$status") {
+ undef @$image;
+ handleMagickError( __FILE__, __LINE__, "$a_geometry", $status);
+ return -1; # Try to read next image }
+ }
# Read image
- print( STDERR "Reading ${imagename} ...\n" ) if $opt_debug;
- $status = $image->Read("${imagename}");
+ print( STDERR "Reading ${imagename}\[0\] with geometry ${a_geometry}...\n" ) if $opt_debug;
+ $status = $image->Read("${imagename}\[0\]");
if ("$status" && handleMagickError( __FILE__, __LINE__, $imagename, $status)) {
undef @$image; # Only delete image data, not object
print("Trying next image ...\n" );
@@ -3930,20 +3747,20 @@
#
if ( $a_prehook ) {
print("Evaluating thumbnail pre-hook ...\n$a_prehook\n" )
- if $opt_debug;
+ if $opt_debug;
eval $a_prehook;
}
print( STDERR "Reading ${imagename}\[0\] with geometry ${a_geometry}...\n" ) if $opt_debug;
$status = $image->Read("${imagename}\[0\]");
- if ("$status" && handleMagickError( __FILE__, __LINE__, $imagename, $status)) {
- undef @$image; # Only delete image data, not object
- print("Trying next image ...\n" );
+ if ("$status") {
+ undef @$image;
+ handleMagickError( __FILE__, __LINE__, $imagename, $status);
return -1; # Try to read next image }
}
# Obtain image parameters
( $width, $height, $filesize, $magick, $class, $depth ) =
$image->Get(
- 'width',
- 'height',
- 'filesize',
- 'magick',
- 'class',
- 'depth');
-
+ 'width',
+ 'height',
+ 'filesize',
+ 'magick',
+ 'class',
+ 'depth');
+
if ( $opt_debug ) {
print("Image: ${width}x${height} $class $filesize bytes $magick $depth bits\n");
}
@@ -3957,30 +3774,28 @@
$width = $base_columns;
$height = $base_rows;
print("Saving original image size ${base_columns}x${base_rows}\n")
- if $opt_debug;
+ if $opt_debug;
}
@@ -3826,7 +3834,11 @@
my $geometry;
-# if ( $a_cache ) {
-# $geometry = $opt_cachegeom;
-# } else {
-# $geometry = $a_geometry;
-# }
- #PMF: I simplified this calculation of the geometry
- $geometry = $a_geometry;
+ if ($a_cache && !$a_tables && !$a_lowres) {
+ $geometry = $opt_cachegeom;
+ } else {
+ $geometry = $a_geometry;
+ }
my $a_sampling = 0; # Set to 1 to enable sampling
if ( $class eq 'PseudoClass' && $a_sampling ) {
print( STDERR "Sampling $imagename to geometry \"${geometry}>\" ...\n")
- if $opt_debug;
+ if $opt_debug;
$status = $image->Sample(geometry=>"${geometry}>");
} else {
print( STDERR "Zooming $imagename with geometry \"${geometry}>\" ...\n")
- if $opt_debug;
+ if $opt_debug;
$status = $image->Zoom(filter=>"${opt_zoomfilter}",
- blur=>0.6,
- geometry=>"${geometry}>" );
+ blur=>0.6,
+ geometry=>"${geometry}>" );
}
if ("$status") {
@@ -4000,9 +3815,8 @@
# If we are caching, thumbnail is new, and image is
# large enough, then write it to thumbnail cache
- # if we are using tables, then we cache as long as it's new
- if ( ($a_cache || $a_tables || $a_lowres) && $newthumb && ((($width*$height) > $a_cachemin) || $a_tables)) {
-
+ # if we are using tables or lowres, then we cache as long as it's new
+ if ( ($a_cache || $a_tables || $a_lowres) && $newthumb && ((($width*$height) > $a_cachemin) || ($a_tables || $a_lowres ))) {
my $comment="IMGINFO:${width}x${height} ${magick} file (${filesize} bytes)";
print( STDERR "Applying image comment:\n${comment}\n") if $opt_debug;
@@ -4011,21 +3825,21 @@
# Apply comment to thumbnail image
$status = $image->Comment( $comment );
handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
- handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
+ if ("$status") {
+ undef @$image;
+ handleMagickError( __FILE__, __LINE__, $cachename, $status);
+ return -1;
+ }
- print( STDERR "Writing ${cachename} with format ${a_cacheformat} ...\n" )
- if $opt_debug;
+ print( STDERR "Writing ${cachename} ...\n" )
+ if $opt_debug;
#
# Give JPEG files special treatment
#
if ( $a_cacheformat eq 'JPEG' || $a_cacheformat eq 'JPG' ) {
$status = $image->Write(
- filename=>"${a_cacheformat}:${cachename}",
- interlace=>'None',
- quality=>85
- );
+ filename=>"${a_cacheformat}:${cachename}",
+ interlace=>'None',
+ quality=>85
+ );
} else {
$status = $image->Write(
- filename=>"${a_cacheformat}:${cachename}"
- );
+ filename=>"${a_cacheformat}:${cachename}"
+ );
print( STDERR "Writing ${cachename} ...\n" )
if $opt_debug;
@@ -3844,7 +3856,11 @@
filename=>"${a_cacheformat}:${cachename}"
);
}
handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
- handleMagickError( __FILE__, __LINE__, $cachename, $status) if "$status";
+ if ("$status") {
+ undef @$image;
+ handleMagickError( __FILE__, __LINE__, $cachename, $status);
+ return -1;
+ }
if (! $a_lowres) {
@@ -4036,73 +3850,73 @@
# TODO: for some reason, the output looks like these are getting put in twice, once with .cache/
$thumbImageSizes{$imagename} = html_imgsize($cachename);
@@ -3916,12 +3932,13 @@
print( STDERR "Applying image label: \"${label}\"\n" )
if $opt_debug;
$status = $image->Label( $label );
- handleMagickError( __FILE__, __LINE__, $imagename, $status) if "$status";
+ if ("$status") {
+ undef @$image;
+ handleMagickError( __FILE__, __LINE__, $imagename, $status);
+ return -1;
+ }
}
#
- # Set image label
- #
- my $label = '';
- if( $opt_thumblabel ne 'false' ) {
- if( defined( $imageLabels{$imagename} ) ) {
- # Set image specific label
- $label = $imageLabels{$imagename};
- } else {
- # Set default label
- $label = $opt_thumblabel;
- }
+ # Set image label
+ #
+ my $label = '';
+ if( $opt_thumblabel ne 'false' ) {
+ if( defined( $imageLabels{$imagename} ) ) {
+ # Set image specific label
+ $label = $imageLabels{$imagename};
+ } else {
+ # Set default label
+ $label = $opt_thumblabel;
}
+ }
- if ($label ne '') {
- my $sizestr;
- my $kb = 1024;
- my $mb = $kb * $kb;
- if( $filesize <= 9999 ) {
- # print as bytes
- $sizestr = "${filesize}b";
- } elsif( $filesize <= 9999999 ) {
- # print as kilobytes
- my $size = int($filesize/$kb);
- $sizestr = "${size}kb";
- } else {
- # print as megabytes
- my $size = int($filesize/$mb);
- $sizestr = "${size}Mb";
- }
- undef @$image;
- undef $image;
-
- #
- # Truncate label down to width $opt_thumblabelwidth
- #
- my $imagebase;
- ($imagebase = $imagename) =~ s/\.[^\.]*$//g;
- # %b = file size
- # %d = directory (not implemented)
- # %e = extension (not implemented)
- # %f = full filename
- # %h = height
- # %m = magick
- # %n = filename minus extension
- # %s = scene number (not implemented)
- # %t = top of filename (not implemented)
- # %w = width
- $label =~ s/%b/$sizestr/g;
- $label =~ s/%f/$imagename/g;
- $label =~ s/%h/$height/g;
- $label =~ s/%m/$magick/g;
- $label =~ s/%n/$imagebase/g;
- $label =~ s/%w/$width/g;
- my @llines = split(/\\n/, $label);
- grep($_ = substr( $_, 0, $opt_thumblabelwidth), @llines);
- $label = join("\n", @llines);
-
- # put our label into the table image hash
-
- $tableImageLabels{$imagename} = $label;
- $tableImageLabels{$imagename} =~ s/\n/<BR>/g;
-
- print( STDERR "Applying image label: \"${label}\"\n" )
- if $opt_debug;
- $status = $image->Label( $label );
- handleMagickError( __FILE__, __LINE__, $imagename, $status) if "$status";
+ if ($label ne '') {
+ my $sizestr;
+ my $kb = 1024;
+ my $mb = $kb * $kb;
+ if( $filesize <= 9999 ) {
+ # print as bytes
+ $sizestr = "${filesize}b";
+ } elsif( $filesize <= 9999999 ) {
+ # print as kilobytes
+ my $size = int($filesize/$kb);
+ $sizestr = "${size}kb";
+ } else {
+ # print as megabytes
+ my $size = int($filesize/$mb);
+ $sizestr = "${size}Mb";
}
-
+ #
+ # Truncate label down to width $opt_thumblabelwidth
+ #
+ my $imagebase;
+ ($imagebase = $imagename) =~ s/\.[^\.]*$//g;
+ # %b = file size
+ # %d = directory (not implemented)
+ # %e = extension (not implemented)
+ # %f = full filename
+ # %h = height
+ # %m = magick
+ # %n = filename minus extension
+ # %s = scene number (not implemented)
+ # %t = top of filename (not implemented)
+ # %w = width
+ $label =~ s/%b/$sizestr/g;
+ $label =~ s/%f/$imagename/g;
+ $label =~ s/%h/$height/g;
+ $label =~ s/%m/$magick/g;
+ $label =~ s/%n/$imagebase/g;
+ $label =~ s/%w/$width/g;
+ my @llines = split(/\\n/, $label);
+ grep($_ = substr( $_, 0, $opt_thumblabelwidth), @llines);
+ $label = join("\n", @llines);
+
+ # put our label into the table image hash
+
+ $tableImageLabels{$imagename} = $label;
+ $tableImageLabels{$imagename} =~ s/\n/<BR>/g;
+
+ print( STDERR "Applying image label: \"${label}\"\n" )
+ if $opt_debug;
+ $status = $image->Label( $label );
+ handleMagickError( __FILE__, __LINE__, $imagename, $status) if "$status";
+ }
+
+
return 0;
}
######################################################################
@@ -4274,12 +4088,11 @@
--cachemin Smallest image to cache in pixels. (default 300*200)
Low resolution images:
- --[no]lowres Cache low resolution images (default on)
+ --[no]lowres Cache low resolution images (default on for Javascript, off otherwise)
--lowresdir Subdirectory name to cache low resolution images in (default .640x480)
--lowresformat Format of cached low resolution images (default JPEG)
--lowresgeom Cache low resolution geometry (default 640x480+2+2)
--lowresmin Smallest image to resize in pixels. (default 640*480)
- --lowresgeometry Low resolution geometry (widthxheight)
Montage:
--[no]forcegif Force imagemap to be in GIF format (default off)

View File

@ -1,33 +0,0 @@
Index: webmagick.js
===================================================================
RCS file: /cvsroot/webmagick/WebMagick/webmagick.js,v
retrieving revision 1.42
retrieving revision 1.44
diff -u -r1.42 -r1.44
--- webmagick.js 17 Aug 2002 00:29:58 -0000 1.42
+++ webmagick.js 7 Sep 2002 09:37:26 -0000 1.44
@@ -1,5 +1,5 @@
//
-// $Id: webmagick.js,v 1.42 2002/08/17 00:29:58 clindell Exp $
+// $Id: webmagick.js,v 1.44 2002/09/07 09:37:26 ache Exp $
//
// JavaScript routines to display a set of images
// Part of the WebMagick package
@@ -767,7 +767,7 @@
//PMF: the images of a given resolution are in a subdirectory with that name
if (resolution != "") {
// result += '<P ALIGN="center"><A HREF ="javascript:oldres = parent.webmagick.resolution;parent.webmagick.resolution='+"'';"+'parent.webmagick.displayImage();parent.webmagick.resolution=oldres;"><IMG SRC="' + resolution + escapeURL(image) + '" ALT=""></A></P>\n';
- result += '<P ALIGN="center"><A HREF ="javascript:parent.webmagick.displayFullImage();"><IMG SRC="' + resolution + image + '" ALT=""></A></P>\n';
+ result += '<P ALIGN="center"><A HREF ="javascript:parent.webmagick.displayFullImage();"><IMG SRC="' + resolution + image + '.jpeg" ALT=""></A></P>\n';
} else {
result += '<P ALIGN="center"><IMG SRC="' + resolution + escapeURL(image) + '" ALT=""></P>\n';
}
@@ -1132,7 +1132,7 @@
//PMF: helper function to find the value of the selection
function choseResolution(numChoice){
var choice;
- alert("¡HOLA RADIOLA (2)!");
+ //alert("¡HOLA RADIOLA (2)!");
if (selectDisabled) {
selectDisabled = 0;