#
# 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;
while (($char = &getchar) ne '>') {
$tag .= $char;
}
- print attrfix($tag);
+ print &attrfix($tag);
print ">";
$_ = $pushback;
}
$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}";