GD over FastCGI

@font-face

CSS3 ushers in a myriad of cool, new capabilities for making the web an even cooler resource, and a couple of them are similar to gdofcgi functions:

  • @font-face
  • image resizing

@font-face

@font-face {
  font-family: 'coolfont';
  src: url('coolfont.eot');  /* IE6+ */
  src:
        url('coolfont.woff') format('woff'),  /* FF3.6 */
        url('coolfont.ttf') format('truetype');  /* Saf3+,Chrome,FF3.5,Opera10+ */
}

Image Resizing

-ms-interpolation-mode: bicubic: introduce in IE7
image-rendering: optimizeQuality: introduced in FireFox 3.6

-moz-transform: scale(sx[, sy])
-webkit-transform:scale(sx[, sy])

Impact

Will this affect the utility of gdofcgi? Not really, as far as I can see. Some fonts don’t have licenses which allow embedded in user browsers, and it may be faster to use gdofcgi in some scenarios.

Also, image resizing en mass will definitely be more efficient by doing it once on the server, instead of every time a client loads the image.

Links

New Feature: Image Resizing

Based on another NGINX module, the image filter module, I’ve created a new binary for resizing images.

It’s extremely new and untested, but its available in the repository.

I’m pretty excited about it, as this is something I’ve wanted to setup for a long time.

No Anti-Aliasing for Circles?

I’m implementing some new ideas into GD over FastCGI and one of them is based on an NGINX module for creating gif circles.

Why do such a thing? They can be used to create rounded corners on HTML elements!

Unfortunately, and surprisingly, GD doesn’t support anti-aliasing alpha channels! Its surprising because it handles anti-aliasing with TrueType fonts so incredibly well.

I guess a workaround could be to find a TrueType font that has an exact circle character and use that instead of manually drawing a circle.

Alas, its not really necessary at all, because the only browser which really needs something like this is Microsoft Internet Explorer, and the versions which need it don’t even support PNGs with alpha channels (out of the box).

New Parameter: Padding

This is useful for some wacky fonts which don’t work well with the brect sizing technique with libgd.

Right now it adds the padding to all dimensions, but I’m thinking about setting up settings for left, right, top and bottom.

Requirements

To Build GD over FastCGI:

  • cdb
  • libgd
  • libfastcgi
  • qDecoder

Bug Fixes and Lingering Questions

I revisited GD over FCGI yesterday as some larger fonts were getting cropped. That is now fixed! I also updated a lot of the code to make the program more robust and less prone to failure.

There are still some outstanding questions:

  • How should multiple / custom font folders get supported? Currently the path to the aenigma folder is hard-coded.
  • Which standard CGI library should I use?

CGI Support

I’ve decided to add CGI support at some point in the future. Why?

Here’s why I’ve decided to add CGI support:

  • FastCGI processes consume memory while they run
  • CGI binaries can be run by lots and lots of simple HTTP daemons
  • Caching proxies can prevent unnecessarily starting and restarting gdofcgi processes

I’m planning to retain support for FastCGI of course!

Works With Apache Mod_fcgi and Lighttpd’s Spawn-fcgi

I’m pleased to report that I’ve finally got GD over FastCGI working with both Apache mod_fcgi and Lighttpd’s spawn-fcgi!

There is still a lot of work to do regarding font paths, but I had to report this important milestone in the progress.