O'Reilly logo

Programming Web Graphics with Perl and GNU Softwar by Shawn Wallace

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Web Graphics Cookbook

Several idioms have evolved on the Web that are worth examining in depth; the phenomenon of web counters, for example, or the culture of web cams. This chapter provides some reusable examples of common web graphics applications:

  • The BrokenImage module that enables Perl-based CGI scripts that generate graphics to present error messages to a web browser rather than a generic broken image icon.

  • A web page access counter that will be updated every time a user views the page. Even though some people rail against counters, they are still a much asked-for feature by new web authors.

  • A JavaScript rollover example, because rollovers are also a much requested feature, and they are too widely used to be ignored.

  • A Web Cam how-to.

  • A section on providing ASCII ALT attributes so that your images may be viewed in some approximation by text-only browsers.

  • Thumbnailing scripts that will ease the tedium of making thumbnails of large groups of images.

Each recipe is broken down into three sections: a discussion of the problem, what is required for the example, and a discussion of a possible solution or implementation.

The BrokenImage Module

A web page that accesses a dynamically generated image runs the risk of displaying uninformative “broken” images if the script that generates the image fails to successfully complete its operation. The fact that an <IMG> element that calls a script from its SRC attribute expects a valid stream of image headers and data can make it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required