imgsrc : free html tool
imgsrc |
imgsrc takes a list of html
files on the command line and processes them, automatically putting
height= and width= tags into the source code where necessary by
finding the referenced .gif or .jpg and calculating its size. It doesn't
work in all cases (like nonexistant or internet-referenced images),
but can speed up web development in many cases if used.
|
why width= and height=? |
Web pages which include
height and width information for all images load faster. The client
web browser can display a page with empty spots for the images while
the images download. If there is no information in the html, this
can't be done until the images have started downloading and the
browser can figure out what size they're going to be. Unfortunately,
if you code html by hand it is tedious to manually fill in each
image's size.
|
download |
imgsrc.exe (68k) |
Executable. DOS / 95 / 98 |
To support long filenames under 95/98, type:
SET LFN=y
at the DOS prompt before running the program.
|
imgsrc.cc | source code |
This should compile with any ANSI C++ compiler that has rudimentary
support for unix file/stream features. It is known to work with DJGPP (DOS)
and g++ (linux / x86). |
use |
Run imgsrc in the directory where
your web documents reside. The paths to images should be relative to this
directory (either in it, or specified with a relative path). If the html
references images with absolute paths (like /images/dot.gif), use the -r
option to specify the local directory which represents the server root.
Run it like this:
C:\WEB\> imgsrc index.html
It will run and modify index.html in place, instrumenting it with
height= and width= information when possible. You can also give multiple
files:
C:\WEB\RESUME\> imgsrc doc1.html doc2.html doc3.html
Which means that under a bash-like shell you can give wildcards:
% imgsrc *.html
Maybe in unix you have your web docs stored in /home/httpd/html and
you specify some absolute paths to images. Run the same way, but add
the -r option:
% imgsrc -r /home/httpd/html *.html
|
free |
imgsrc is distributed under the
GNU public license and is free software. This means you can use,
distribute, and modify it however you like, as long as you always make
the source code available. You can read the license at
GNU's Website.
|
warranty |
No warranty whatsoever.
This program expects image tags to be formatted like this:
<img src=../something.gif>
And while it will accept some variations, there is surely some legal
html which it won't accept. To the best of my knowledge, it should just
ignore these situations (not insert width= and height=), though this
is not guaranteed. Keep backups.
|
possible improvements |
If you like, consider making any of the following improvements. I'll be glad to post improvements to imgsrc on this page. Remember that derived programs must also be GPL (open-source!).
Support more valid html styles
Connect to the internet to retrieve <img src=http://www.images.com/banner.gif> stuff.
Build as an Apache Module, to run on webservers and modify the source at serve time.
[[ computerbits ]]
|
|
|