From c8a225e481f4157ec81d926e0d53206ebed0d42a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 9 Oct 1996 23:28:37 +0000 Subject: [PATCH] Make HEIGHT and WIDTH recognition caseblind. Fix syntax error in attrib call. --- imgsizer | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/imgsizer b/imgsizer index ded6833..c731dff 100755 --- a/imgsizer +++ b/imgsizer @@ -3,30 +3,28 @@ # # imgsizer -- correct image sizes in WWW pages # +# by Eric S. Raymond 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 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}"; -- 2.43.0