]> thyrsus.com Git - imgsizer.git/commitdiff
Make HEIGHT and WIDTH recognition caseblind.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 9 Oct 1996 23:28:37 +0000 (23:28 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 9 Oct 1996 23:28:37 +0000 (23:28 +0000)
Fix syntax error in attrib call.

imgsizer

index ded6833ceef7957f6dd248a38fd709d28507ad96..c731dff00cb04587ae9ec813526d9e9043a4d63e 100755 (executable)
--- a/imgsizer
+++ b/imgsizer
@@ -3,30 +3,28 @@
 #
 # imgsizer -- correct image sizes in WWW pages
 #
+# by Eric S. Raymond <esr@thyrsus.com> 30 Jul 1996
+#
 # Fix up IMG tags in given documents to contain correct sizes.
 # Requires the identify(1) program from the ImageMagick suite.
 # To fix up sizes for non-local images it requires the httpget(1) script.
 #
-# The man page for this program is included at the end of this file and can be
-# viewed using the command 'nroff -man imgsizer'.
-#
-# by Eric S. Raymond <esr@thyrsus.com> 30 Jul 1996
 # Copy, use, and redistribute freely, but don't take my name off it and
 # clearly mark an altered version.  Fixes and enhancements cheerfully 
 # accepted.
 #
-# This is version 1.0.
+# This is version 1.1.
 #
 
+$out = "imgsizer-out$$";
 if (@ARGV) {
-       $out = "imgsizer-out$$";
        foreach $x (@ARGV) {
                $file = $x;
                open(TEMP, ">$out")
                        || die("imgsizer: couldn't open tempfile $out \n");
                close(STDIN);
-               if (!open(STDIN, $file)) {
-                       print STDERR "imgsize: couldn't open ${file} for input\n";
+               if (!open(STDIN, "$file")) {
+                       print STDERR "imgsize: couldn't open $x for input\n";
                } else {
                        select(TEMP);
                        &sizefix;
@@ -64,7 +62,7 @@ sub sizefix
                        while (($char = &getchar) ne '>') {
                                $tag .= $char;
                        }
-                       print attrfix($tag);
+                       print &attrfix($tag);
                        print ">";
                        $_ = $pushback;
                }
@@ -115,12 +113,12 @@ sub attrfix
        $xc = $1;
        $yc = $2;
 
-       if ($attribs =~ /WIDTH=[0123456789]+/) {
+       if ($attribs =~ /WIDTH=[0123456789]+/i) {
                $attribs = "$`WIDTH=${xc}$'";
        } else {
                $attribs .= " WIDTH=${xc}";
        }
-       if ($attribs =~ /HEIGHT=[0123456789]+/) {
+       if ($attribs =~ /HEIGHT=[0123456789]+/i) {
                $attribs = "$`HEIGHT=${yc}$'";
        } else {
                $attribs .= " HEIGHT=${yc}";