HTML and CSS Reference
However, if there are many such problems, you'll want to automate the process with a program that parses the
documents and fills in the missing sizes. Randal Schwartz has published a Perl script called addsize that does
this, which you can find at www.stonehenge.com/merlyn/WebTechniques/col36.html . It's a little old, but it's still
functional. Marc Merlins has another at http://marc.merlins.org/linux/scripts/addsize that is based on
ImageMagik. And Eric S. Raymond has written one called imgsizer in Python ( www.catb.org/~esr/imgsizer/ ).
None of them is perfect, but imgsizer is probably the most up-to-date and reliable. It should run on most
UNIX/Linux variants fairly easily.
To update one file in place, just type:
$ imgsizer -n filename.html
To change all HTML files in a directory, use the -d option:
$ imgsizer -n -d /var/www/html
This program does not back up the files before changing them, and it can create malformed files in some cases.
Be sure to make a backup before running it or any similar utility. Indeed, it's probably a good idea to run the
tool on only a copy of your files and to verify the modified copy before proceeding.