cp imgsizer httpget $(BINDIR)
cp imgsizer.man $(MANDIR)/imgsizer.1
-DISTDIR = imgsizer-1.1
+DISTDIR = imgsizer-1.2
FILES = $(DISTDIR)/Makefile $(DISTDIR)/READ.ME $(DISTDIR)/httpget \
$(DISTDIR)/imgsizer $(DISTDIR)/imgsizer.lsm \
$(DISTDIR)/imgsizer.man
$(DISTDIR).tar.gz: $(DISTDIR).tar
gzip -f $(DISTDIR).tar
+dist: $(DISTDIR).tar.gz
+ ls -l $(DISTDIR).tar.gz
- imgsizer -- autogenerate WIDTH and HEIGHT for IMG tags
+ imgsizer -- autogenerate WIDTH and HEIGHT for IMG tags
This is a nifty little HTML authoring tool that will generate correct
Netscape-style WIDTH and HEIGHT parameters for each of your IMG tags.
+This will enable the text parts of your page to load much faster.
Files in this directory:
already on your system; otherwise, you should be able to get it from
ftp://ftp.x.org/contrib/applications/ImageMagick.
-Usual terms -- copy, use, and redistribute as you like, don't take
+Usual FRS terms -- copy, use, and redistribute as you like, don't take
my name off it, and clearly mark any modified versions. Fixes
and enhancements cheerfully accepted. Enjoy!
-- esr
+ http://www.ccil.org/~esr
# clearly mark an altered version. Fixes and enhancements cheerfully
# accepted.
#
-# This is version 1.1.
+# This is version 1.2.
#
+# Anything that can fetch a URL defined on the command line
+# and dump it to stdout will do here.
+$fetcher = 'httpget';
+
$out = "imgsizer-out$$";
if (@ARGV) {
foreach $x (@ARGV) {
$file = $x;
+ $dir = &dirname($x);
open(TEMP, ">$out")
|| die("imgsizer: couldn't open tempfile $out \n");
close(STDIN);
select(TEMP);
&sizefix;
close(TEMP);
- if (!rename($out, $file)) {
+ if (system("cp $out $file")) {
print STDERR "imgsize: couldn't replace ${file}\n}";
}
}
&sizefix;
}
+sub dirname
+# return filename with the basename part stripped away
+{
+ my($file) = @_;
+ if ($file =~ /\//) {
+ $file =~ s:/[^/]*$::;
+ } else {
+ $file = ".";
+ }
+ return($file);
+}
+
sub getchar
{
$pushback = <STDIN> if (length($pushback) == 0);
if ($url =~ /^http:/) {
$image = "imgsizer-tmp$$";
- $status = system("httpget ${url} >${image}");
+ $status = system("$fetcher ${url} >${image}");
if ($status) {
&error("can't fetch $1");
unlink("imgsizer-tmp$$");
return $attribs;
}
}
- else {
- $image = $url; # This catches local files
+ elsif (!($url =~ /^[a-z]+:/)) {
+ $image = "$dir/$url"; # This catches local files
+
}
($name, $size) = split(' ', `identify ${image}`);
parameters help many browsers (including Netscape) to multi-thread
image loading, instead of having to load images in strict sequence in
order to have each one's dimensions available so the next can be
-placed. This generally alllows text on the remainder of the page
+placed. This generally allows text on the remainder of the page
to load much faster.
.PP
This script may be called with no arguments. In this mode, it filters
itself has no knowledge of graphics formats. The script will handle any
image format known to
.IR identify (1)
-including GIF, JPEG, XBM, XPM, PostScript, BMP, TIFF, and anything else
+including PNG, GIF, JPEG, XBM, XPM, PostScript, BMP, TIFF, and anything else
even remotely likely to show up as an inline image.
.PP
In order for
.IR httpget (1)
must be executable and present in your execution path;
.B imgsizer
-will complain and fail if
+will complain and fail if either
+.IR identify (1)
+or
.IR httpget (1)
is needed and not present.
.SH AUTHOR
-Eric S. Raymond <esr@thyrsus.com>.
+Eric S. Raymond <esr@thyrsus.com>. See my home page at
+http://www.ccil.org/~esr for updates.
.SH SEE ALSO
.IR identify (1),
.IR httpget (1).