]> thyrsus.com Git - imgsizer.git/commitdiff
Ready to release.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 26 Mar 1997 15:14:25 +0000 (15:14 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 26 Mar 1997 15:14:25 +0000 (15:14 +0000)
Makefile
README
imgsizer
imgsizer.xml

index 8c357914b3d0b5ad4b956a2ea1c16378fcbb2f72..054ce953906974b49b9f6fb47a31eeeb10bb90f0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ install:
        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
@@ -17,3 +17,5 @@ $(DISTDIR).tar:
 $(DISTDIR).tar.gz: $(DISTDIR).tar
        gzip -f $(DISTDIR).tar
 
+dist: $(DISTDIR).tar.gz
+       ls -l $(DISTDIR).tar.gz
diff --git a/README b/README
index 10980e5d5b3e3bf810956a4598b0a0ead611d688..2b1c42d209cf617370432531f3dc915b830c1b9a 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,8 @@
-               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:
 
@@ -20,10 +21,11 @@ work.  If you are using Linux or any of the free BSDs it is probably
 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
 
 
 
index a53bba8f9da8364950f29442e3ac28de25c13911..fea451d30316ab09b55c1bc50037a6ef0186228e 100755 (executable)
--- a/imgsizer
+++ b/imgsizer
 # 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);
@@ -29,7 +34,7 @@ if (@ARGV) {
                        select(TEMP);
                        &sizefix;
                        close(TEMP);
-                       if (!rename($out, $file)) {
+                       if (system("cp $out $file")) {
                                print STDERR "imgsize: couldn't replace ${file}\n}";
                        }
                }
@@ -41,6 +46,18 @@ else {
        &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);
@@ -89,15 +106,16 @@ sub attrfix
 
        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}`);
index 0d1342e2dd5c6a9c5341c03fcbc8b09ba9b25626..3ab93310c6f587e522a56247e1aeb176af46a518 100644 (file)
@@ -13,7 +13,7 @@ extension HEIGHT and WIDTH parameters in HTML IMG tags.  These
 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
@@ -34,7 +34,7 @@ utility is used to extract sizes from the images;
 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
@@ -43,11 +43,14 @@ to correctly interpret remote URLs, the freeware script
 .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).